From 23086bfec70dd5f5fa768d56cbec20e39cf44733 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Tue, 14 Oct 2025 18:54:58 +0300 Subject: [PATCH 1/2] Fix typo in `pep-0810.rst` --- peps/pep-0810.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/peps/pep-0810.rst b/peps/pep-0810.rst index dd6969a8b77..c3b6550d2f0 100644 --- a/peps/pep-0810.rst +++ b/peps/pep-0810.rst @@ -374,7 +374,7 @@ When an import is lazy, ``__lazy_import__`` is called instead of ``__import__``. It adds the module name to ``sys.lazy_modules``, a set of fully-qualified module names which have been lazily imported at some point (primarily for diagnostics and introspection), and returns a -:class:`!types.LazyImportType`` object for the module. +:class:`!types.LazyImportType` object for the module. The implementation of ``from ... import`` (the ``IMPORT_FROM`` bytecode implementation) checks if the module it's fetching from is a lazy module From 92da87b1a55897e204e2ba7bef4725e4a64d434d Mon Sep 17 00:00:00 2001 From: sobolevn Date: Tue, 14 Oct 2025 19:20:41 +0300 Subject: [PATCH 2/2] Address review --- peps/pep-0810.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/peps/pep-0810.rst b/peps/pep-0810.rst index c3b6550d2f0..cf9c156bf1b 100644 --- a/peps/pep-0810.rst +++ b/peps/pep-0810.rst @@ -755,8 +755,8 @@ These changes are limited to bindings explicitly made lazy: when it is first used. * **Proxy visibility.** Before first use, the bound name refers to a lazy proxy. Indirect introspection that touches the value may observe a proxy - lazy object representation. After first use (provied the module was - imported succesfully), the name is rebound to the real object and becomes + lazy object representation. After first use (provided the module was + imported successfully), the name is rebound to the real object and becomes indistinguishable from an eager import. Thread-safety and reification @@ -787,7 +787,7 @@ code that doesn't. Runtime performance ~~~~~~~~~~~~~~~~~~~ -After reification (provided the import was succesful), lazy imports have +After reification (provided the import was successful), lazy imports have **zero overhead**. The adaptive interpreter specializes the bytecode (typically after 2-3 accesses), eliminating any checks. For example, ``LOAD_GLOBAL`` becomes ``LOAD_GLOBAL_MODULE``, which directly accesses the