Merge branch 'main' into tokenize-thread-safety · python/cpython@975f01a · GitHub
Skip to content

Commit 975f01a

Browse files
committed
Merge branch 'main' into tokenize-thread-safety
2 parents 117d256 + 0335662 commit 975f01a

63 files changed

Lines changed: 1614 additions & 403 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion

Doc/library/os.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ process and user.
193193
to the environment made after this time are not reflected in :data:`os.environ`,
194194
except for changes made by modifying :data:`os.environ` directly.
195195

196+
The :meth:`!os.environ.refresh()` method updates :data:`os.environ` with
197+
changes to the environment made by :func:`os.putenv`, by
198+
:func:`os.unsetenv`, or made outside Python in the same process.
199+
196200
This mapping may be used to modify the environment as well as query the
197201
environment. :func:`putenv` will be called automatically when the mapping
198202
is modified.
@@ -225,6 +229,9 @@ process and user.
225229
.. versionchanged:: 3.9
226230
Updated to support :pep:`584`'s merge (``|``) and update (``|=``) operators.
227231

232+
.. versionchanged:: 3.14
233+
Added the :meth:`!os.environ.refresh()` method.
234+
228235

229236
.. data:: environb
230237

@@ -561,6 +568,8 @@ process and user.
561568
of :data:`os.environ`. This also applies to :func:`getenv` and :func:`getenvb`, which
562569
respectively use :data:`os.environ` and :data:`os.environb` in their implementations.
563570

571+
See also the :data:`os.environ.refresh() <os.environ>` method.
572+
564573
.. note::
565574

566575
On some platforms, including FreeBSD and macOS, setting ``environ`` may
@@ -809,6 +818,8 @@ process and user.
809818
don't update :data:`os.environ`, so it is actually preferable to delete items of
810819
:data:`os.environ`.
811820

821+
See also the :data:`os.environ.refresh() <os.environ>` method.
822+
812823
.. audit-event:: os.unsetenv key os.unsetenv
813824

814825
.. versionchanged:: 3.9

Doc/library/xml.etree.elementtree.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ Functions
508508
`C14N 2.0 <https://www.w3.org/TR/xml-c14n2/>`_ transformation function.
509509

510510
Canonicalization is a way to normalise XML output in a way that allows
511-
byte-by-byte comparisons and digital signatures. It reduced the freedom
511+
byte-by-byte comparisons and digital signatures. It reduces the freedom
512512
that XML serializers have and instead generates a more constrained XML
513513
representation. The main restrictions regard the placement of namespace
514514
declarations, the ordering of attributes, and ignorable whitespace.

Doc/whatsnew/3.14.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ ast
9292
Added :func:`ast.compare` for comparing two ASTs.
9393
(Contributed by Batuhan Taskaya and Jeremy Hylton in :issue:`15987`.)
9494

95+
os
96+
--
97+
98+
* Added the :data:`os.environ.refresh() <os.environ>` method to update
99+
:data:`os.environ` with changes to the environment made by :func:`os.putenv`,
100+
by :func:`os.unsetenv`, or made outside Python in the same process.
101+
(Contributed by Victor Stinner in :gh:`120057`.)
95102

96103

97104
Optimizations

Include/internal/pycore_global_objects_fini_generated.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_global_strings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ struct _Py_global_strings {
4545
STRUCT_FOR_STR(dot, ".")
4646
STRUCT_FOR_STR(dot_locals, ".<locals>")
4747
STRUCT_FOR_STR(empty, "")
48+
STRUCT_FOR_STR(format, ".format")
4849
STRUCT_FOR_STR(generic_base, ".generic_base")
4950
STRUCT_FOR_STR(json_decoder, "json.decoder")
5051
STRUCT_FOR_STR(kwdefaults, ".kwdefaults")
@@ -234,7 +235,6 @@ struct _Py_global_strings {
234235
STRUCT_FOR_ID(_abstract_)
235236
STRUCT_FOR_ID(_active)
236237
STRUCT_FOR_ID(_align_)
237-
STRUCT_FOR_ID(_annotation)
238238
STRUCT_FOR_ID(_anonymous_)
239239
STRUCT_FOR_ID(_argtypes_)
240240
STRUCT_FOR_ID(_as_parameter_)

Include/internal/pycore_opcode_utils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ extern "C" {
5757
#define MAKE_FUNCTION_KWDEFAULTS 0x02
5858
#define MAKE_FUNCTION_ANNOTATIONS 0x04
5959
#define MAKE_FUNCTION_CLOSURE 0x08
60+
#define MAKE_FUNCTION_ANNOTATE 0x10
6061

6162
/* Values used as the oparg for LOAD_COMMON_CONSTANT */
6263
#define CONSTANT_ASSERTIONERROR 0

Include/internal/pycore_runtime_init_generated.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_symtable.h

Lines changed: 6 additions & 2 deletions

Include/internal/pycore_unicodeobject_generated.h

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)