From 08685eb17c521e023a5a43a8b1797d523ccb606d Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Thu, 5 Feb 2026 20:06:33 +0200 Subject: [PATCH 1/2] gh-74955: Document that __all__ must contain strings in normalization form NFKC (GH-144504) (cherry picked from commit c81e1843d4bc0a51cf4f77d19b5ac4e49f714a0d) Co-authored-by: Serhiy Storchaka --- Doc/reference/simple_stmts.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst index 5a9c398b54ca92..2de2404ee89634 100644 --- a/Doc/reference/simple_stmts.rst +++ b/Doc/reference/simple_stmts.rst @@ -834,7 +834,9 @@ where the :keyword:`import` statement occurs. The *public names* defined by a module are determined by checking the module's namespace for a variable named ``__all__``; if defined, it must be a sequence -of strings which are names defined or imported by that module. The names +of strings which are names defined or imported by that module. +Names containing non-ASCII characters must be in the `normalization form`_ +NFKC; see :ref:`lexical-names-nonascii` for details. The names given in ``__all__`` are all considered public and are required to exist. If ``__all__`` is not defined, the set of public names includes all names found in the module's namespace which do not begin with an underscore character @@ -868,6 +870,8 @@ determine dynamically the modules to be loaded. .. audit-event:: import module,filename,sys.path,sys.meta_path,sys.path_hooks import +.. _normalization form: https://www.unicode.org/reports/tr15/#Norm_Forms + .. _future: Future statements From e48e7103b0a154a63857b97bf45962bd3bebaa89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Tue, 24 Mar 2026 02:54:57 +0100 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> --- Doc/reference/simple_stmts.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst index 2de2404ee89634..8ed456a731b101 100644 --- a/Doc/reference/simple_stmts.rst +++ b/Doc/reference/simple_stmts.rst @@ -836,7 +836,7 @@ The *public names* defined by a module are determined by checking the module's namespace for a variable named ``__all__``; if defined, it must be a sequence of strings which are names defined or imported by that module. Names containing non-ASCII characters must be in the `normalization form`_ -NFKC; see :ref:`lexical-names-nonascii` for details. The names +NFKC. The names given in ``__all__`` are all considered public and are required to exist. If ``__all__`` is not defined, the set of public names includes all names found in the module's namespace which do not begin with an underscore character