https://github.com/python/cpython/commit/4d85f0ae76b84bfdba961154e9e38bde27242b9f
commit: 4d85f0ae76b84bfdba961154e9e38bde27242b9f
branch: 3.12
author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com>
committer: JelleZijlstra <jelle.zijls...@gmail.com>
date: 2024-04-21T01:50:01Z
summary:

[3.12] Clarifying nonlocal doc: SyntaxError is raised if nearest enclosing 
scope is global (GH-114009) (#118128)

Clarifying nonlocal doc: SyntaxError is raised if nearest enclosing scope is 
global (GH-114009)
(cherry picked from commit 1558d993166636f371c1003107ec979db6744f21)

Co-authored-by: Quazi Irfan <quazir...@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijls...@gmail.com>

files:
M Doc/reference/executionmodel.rst

diff --git a/Doc/reference/executionmodel.rst b/Doc/reference/executionmodel.rst
index cea3a56ba51644..ed50faed6c940d 100644
--- a/Doc/reference/executionmodel.rst
+++ b/Doc/reference/executionmodel.rst
@@ -139,8 +139,9 @@ namespace.  Names are resolved in the top-level namespace 
by searching the
 global namespace, i.e. the namespace of the module containing the code block,
 and the builtins namespace, the namespace of the module :mod:`builtins`.  The
 global namespace is searched first.  If the names are not found there, the
-builtins namespace is searched.  The :keyword:`!global` statement must precede
-all uses of the listed names.
+builtins namespace is searched next. If the names are also not found in the
+builtins namespace, new variables are created in the global namespace.
+The global statement must precede all uses of the listed names.
 
 The :keyword:`global` statement has the same scope as a name binding operation
 in the same block.  If the nearest enclosing scope for a free variable contains

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to