Skip to content

Commit c89f56f

Browse files
Merge remote-tracking branch 'upstream/main' into pr/142926
2 parents 8b1ded5 + e22c495 commit c89f56f

Some content is hidden

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

46 files changed

+1354
-1053
lines changed

Doc/deprecations/pending-removal-in-3.20.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Pending removal in Python 3.20
22
------------------------------
33

4-
* The ``__version__`` attribute has been deprecated in these standard library
5-
modules and will be removed in Python 3.20.
6-
Use :py:data:`sys.version_info` instead.
4+
* The ``__version__``, ``version`` and ``VERSION`` attributes have been
5+
deprecated in these standard library modules and will be removed in
6+
Python 3.20. Use :py:data:`sys.version_info` instead.
77

88
- :mod:`argparse`
99
- :mod:`csv`
@@ -24,6 +24,9 @@ Pending removal in Python 3.20
2424
- :mod:`tkinter.font`
2525
- :mod:`tkinter.ttk`
2626
- :mod:`wsgiref.simple_server`
27+
- :mod:`xml.etree.ElementTree`
28+
- :mod:`!xml.sax.expatreader`
29+
- :mod:`xml.sax.handler`
2730
- :mod:`zlib`
2831

2932
(Contributed by Hugo van Kemenade and Stan Ulbrych in :gh:`76007`.)

Doc/library/ast.rst

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,13 @@ Node classes
139139
The :meth:`~object.__repr__` output of :class:`~ast.AST` nodes includes
140140
the values of the node fields.
141141

142-
.. deprecated:: 3.8
142+
.. deprecated-removed:: 3.8 3.14
143143

144-
Old classes :class:`!ast.Num`, :class:`!ast.Str`, :class:`!ast.Bytes`,
145-
:class:`!ast.NameConstant` and :class:`!ast.Ellipsis` are still available,
146-
but they will be removed in future Python releases. In the meantime,
147-
instantiating them will return an instance of a different class.
144+
Previous versions of Python provided the AST classes :class:`!ast.Num`,
145+
:class:`!ast.Str`, :class:`!ast.Bytes`, :class:`!ast.NameConstant` and
146+
:class:`!ast.Ellipsis`, which were deprecated in Python 3.8. These classes
147+
were removed in Python 3.14, and their functionality has been replaced with
148+
:class:`ast.Constant`.
148149

149150
.. deprecated:: 3.9
150151

@@ -2419,12 +2420,12 @@ and classes for traversing abstract syntax trees:
24192420
during traversal. For this a special visitor exists
24202421
(:class:`NodeTransformer`) that allows modifications.
24212422

2422-
.. deprecated:: 3.8
2423+
.. deprecated-removed:: 3.8 3.14
24232424

24242425
Methods :meth:`!visit_Num`, :meth:`!visit_Str`, :meth:`!visit_Bytes`,
2425-
:meth:`!visit_NameConstant` and :meth:`!visit_Ellipsis` are deprecated
2426-
now and will not be called in future Python versions. Add the
2427-
:meth:`visit_Constant` method to handle all constant nodes.
2426+
:meth:`!visit_NameConstant` and :meth:`!visit_Ellipsis` will not be called
2427+
in Python 3.14+. Add the :meth:`visit_Constant` method instead to handle
2428+
all constant nodes.
24282429

24292430

24302431
.. class:: NodeTransformer()

Doc/library/mmap.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,17 @@ To map anonymous memory, -1 should be passed as the fileno along with the length
328328

329329
.. versionadded:: 3.13
330330

331+
.. method:: set_name(name, /)
332+
333+
Annotate the memory mapping with the given *name* for easier identification
334+
in ``/proc/<pid>/maps`` if the kernel supports the feature and :option:`-X dev <-X>` is passed
335+
to Python or if Python is built in :ref:`debug mode <debug-build>`.
336+
The length of *name* must not exceed 67 bytes including the ``'\0'`` terminator.
337+
338+
.. availability:: Linux >= 5.17 (kernel built with ``CONFIG_ANON_VMA_NAME`` option)
339+
340+
.. versionadded:: next
341+
331342
.. method:: size()
332343

333344
Return the length of the file, which can be larger than the size of the

Doc/whatsnew/3.15.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,11 @@ mmap
592592
not be duplicated.
593593
(Contributed by Serhiy Storchaka in :gh:`78502`.)
594594

595+
* Added the :meth:`mmap.mmap.set_name` method
596+
to annotate an anonymous memory mapping
597+
if Linux kernel supports :manpage:`PR_SET_VMA_ANON_NAME <PR_SET_VMA(2const)>` (Linux 5.17 or newer).
598+
(Contributed by Donghee Na in :gh:`142419`.)
599+
595600

596601
os
597602
--
@@ -1104,9 +1109,9 @@ New deprecations
11041109

11051110
* ``__version__``
11061111

1107-
* The ``__version__`` attribute has been deprecated in these standard library
1108-
modules and will be removed in Python 3.20.
1109-
Use :py:data:`sys.version_info` instead.
1112+
* The ``__version__``, ``version`` and ``VERSION`` attributes have been
1113+
deprecated in these standard library modules and will be removed in
1114+
Python 3.20. Use :py:data:`sys.version_info` instead.
11101115

11111116
- :mod:`argparse`
11121117
- :mod:`csv`
@@ -1127,6 +1132,9 @@ New deprecations
11271132
- :mod:`tkinter.font`
11281133
- :mod:`tkinter.ttk`
11291134
- :mod:`wsgiref.simple_server`
1135+
- :mod:`xml.etree.ElementTree`
1136+
- :mod:`!xml.sax.expatreader`
1137+
- :mod:`xml.sax.handler`
11301138
- :mod:`zlib`
11311139

11321140
(Contributed by Hugo van Kemenade and Stan Ulbrych in :gh:`76007`.)

Include/internal/pycore_dict.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,7 @@ _PyDict_SendEvent(int watcher_bits,
272272
PyObject *value);
273273

274274
static inline void
275-
_PyDict_NotifyEvent(PyInterpreterState *interp,
276-
PyDict_WatchEvent event,
275+
_PyDict_NotifyEvent(PyDict_WatchEvent event,
277276
PyDictObject *mp,
278277
PyObject *key,
279278
PyObject *value)

Include/internal/pycore_interp_structs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,6 @@ struct _is {
947947
struct _PyExecutorObject *executor_deletion_list_head;
948948
struct _PyExecutorObject *cold_executor;
949949
struct _PyExecutorObject *cold_dynamic_executor;
950-
int executor_deletion_list_remaining_capacity;
951950
size_t executor_creation_counter;
952951
_rare_events rare_events;
953952
PyDict_WatchCallback builtins_dict_watcher;

Include/internal/pycore_mmap.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,27 @@ extern "C" {
1717
#endif
1818

1919
#if defined(HAVE_PR_SET_VMA_ANON_NAME) && defined(__linux__)
20-
static inline void
20+
static inline int
2121
_PyAnnotateMemoryMap(void *addr, size_t size, const char *name)
2222
{
2323
#ifndef Py_DEBUG
2424
if (!_Py_GetConfig()->dev_mode) {
25-
return;
25+
return 0;
2626
}
2727
#endif
28+
// The name length cannot exceed 80 (including the '\0').
2829
assert(strlen(name) < 80);
29-
int old_errno = errno;
30-
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, (unsigned long)addr, size, name);
31-
/* Ignore errno from prctl */
32-
/* See: https://bugzilla.redhat.com/show_bug.cgi?id=2302746 */
33-
errno = old_errno;
30+
int res = prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, (unsigned long)addr, size, name);
31+
if (res < 0) {
32+
return -1;
33+
}
34+
return 0;
3435
}
3536
#else
36-
static inline void
37+
static inline int
3738
_PyAnnotateMemoryMap(void *Py_UNUSED(addr), size_t Py_UNUSED(size), const char *Py_UNUSED(name))
3839
{
40+
return 0;
3941
}
4042
#endif
4143

Include/internal/pycore_opcode_metadata.h

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

Include/internal/pycore_optimizer.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ typedef struct {
2525
uint8_t opcode;
2626
uint8_t oparg;
2727
uint8_t valid;
28-
uint8_t linked;
2928
uint8_t chain_depth; // Must be big enough for MAX_CHAIN_DEPTH - 1.
3029
bool warm;
3130
int32_t index; // Index of ENTER_EXECUTOR (if code isn't NULL, below).
@@ -55,11 +54,6 @@ typedef struct _PyExecutorObject {
5554
_PyExitData exits[1];
5655
} _PyExecutorObject;
5756

58-
/* If pending deletion list gets large enough, then scan,
59-
* and free any executors that aren't executing
60-
* i.e. any that aren't a thread's current_executor. */
61-
#define EXECUTOR_DELETE_LIST_MAX 100
62-
6357
// Export for '_opcode' shared extension (JIT compiler).
6458
PyAPI_FUNC(_PyExecutorObject*) _Py_GetExecutor(PyCodeObject *code, int offset);
6559

@@ -80,7 +74,6 @@ PyAPI_FUNC(void) _Py_Executors_InvalidateCold(PyInterpreterState *interp);
8074
#else
8175
# define _Py_Executors_InvalidateDependency(A, B, C) ((void)0)
8276
# define _Py_Executors_InvalidateAll(A, B) ((void)0)
83-
# define _Py_Executors_InvalidateCold(A) ((void)0)
8477

8578
#endif
8679

0 commit comments

Comments
 (0)