Skip to content

Commit f1ab270

Browse files
committed
Merge branch 'main' into more-tier2-binary-ops
2 parents 646672c + e32f6e9 commit f1ab270

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

+1405
-400
lines changed

Doc/bugs.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ have a suggestion on how to fix it, include that as well.
2222
You can also open a discussion item on our
2323
`Documentation Discourse forum <https://discuss.python.org/c/documentation/26>`_.
2424

25+
If you find a bug in the theme (HTML / CSS / JavaScript) of the
26+
documentation, please submit a bug report on the `python-doc-theme bug
27+
tracker <https://github.com/python/python-docs-theme>`_.
28+
2529
If you're short on time, you can also email documentation bug reports to
2630
[email protected] (behavioral bugs can be sent to [email protected]).
2731
'docs@' is a mailing list run by volunteers; your request will be noticed,

Doc/library/os.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2135,7 +2135,7 @@ features:
21352135

21362136
.. audit-event:: os.chmod path,mode,dir_fd os.chmod
21372137

2138-
.. versionadded:: 3.3
2138+
.. versionchanged:: 3.3
21392139
Added support for specifying *path* as an open file descriptor,
21402140
and the *dir_fd* and *follow_symlinks* arguments.
21412141

@@ -2166,7 +2166,7 @@ features:
21662166
The function is limited on WASI, see :ref:`wasm-availability` for more
21672167
information.
21682168

2169-
.. versionadded:: 3.3
2169+
.. versionchanged:: 3.3
21702170
Added support for specifying *path* as an open file descriptor,
21712171
and the *dir_fd* and *follow_symlinks* arguments.
21722172

@@ -2310,7 +2310,7 @@ features:
23102310
.. versionchanged:: 3.2
23112311
The *path* parameter became optional.
23122312

2313-
.. versionadded:: 3.3
2313+
.. versionchanged:: 3.3
23142314
Added support for specifying *path* as an open file descriptor.
23152315

23162316
.. versionchanged:: 3.6

Doc/library/subprocess.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,8 +754,8 @@ Exceptions defined in this module all inherit from :exc:`SubprocessError`.
754754
Security Considerations
755755
-----------------------
756756

757-
Unlike some other popen functions, this implementation will never
758-
implicitly call a system shell. This means that all characters,
757+
Unlike some other popen functions, this library will not
758+
implicitly choose to call a system shell. This means that all characters,
759759
including shell metacharacters, can safely be passed to child processes.
760760
If the shell is invoked explicitly, via ``shell=True``, it is the application's
761761
responsibility to ensure that all whitespace and metacharacters are
@@ -764,6 +764,14 @@ quoted appropriately to avoid
764764
vulnerabilities. On :ref:`some platforms <shlex-quote-warning>`, it is possible
765765
to use :func:`shlex.quote` for this escaping.
766766

767+
On Windows, batch files (:file:`*.bat` or :file:`*.cmd`) may be launched by the
768+
operating system in a system shell regardless of the arguments passed to this
769+
library. This could result in arguments being parsed according to shell rules,
770+
but without any escaping added by Python. If you are intentionally launching a
771+
batch file with arguments from untrusted sources, consider passing
772+
``shell=True`` to allow Python to escape special characters. See :gh:`114539`
773+
for additional discussion.
774+
767775

768776
Popen Objects
769777
-------------

Doc/license.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,8 @@ https://www.w3.org/TR/xml-c14n2-testcases/ and is distributed under the
10421042
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10431043

10441044

1045+
.. _mimalloc-license:
1046+
10451047
mimalloc
10461048
--------
10471049

Doc/tools/templates/layout.html

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,90 @@
4141
{{ "}" }}
4242
</style>
4343
{{ super() }}
44+
45+
<meta name="readthedocs-addons-api-version" content="1">
46+
<script type="text/javascript">
47+
function onSwitch(event) {
48+
const option = event.target.selectedIndex;
49+
const item = event.target.options[option];
50+
window.location.href = item.dataset.url;
51+
}
52+
53+
document.addEventListener("readthedocs-addons-data-ready", function(event) {
54+
const config = event.detail.data()
55+
56+
// Add some mocked hardcoded versions pointing to the official
57+
// documentation while migrating to Read the Docs.
58+
// These are only for testing purposes.
59+
// TODO: remove them when managing all the versions on Read the Docs,
60+
// since all the "active, built and not hidden" versions will be shown automatically.
61+
let versions = config.versions.active.concat([
62+
{
63+
slug: "dev (3.13)",
64+
urls: {
65+
documentation: "https://docs.python.org/3.13/",
66+
}
67+
},
68+
{
69+
slug: "3.12",
70+
urls: {
71+
documentation: "https://docs.python.org/3.12/",
72+
}
73+
},
74+
{
75+
slug: "3.11",
76+
urls: {
77+
documentation: "https://docs.python.org/3.11/",
78+
}
79+
},
80+
]);
81+
82+
const versionSelect = `
83+
<select id="version_select">
84+
${ versions.map(
85+
(version) => `
86+
<option
87+
value="${ version.slug }"
88+
${ config.versions.current.slug === version.slug ? 'selected="selected"' : '' }
89+
data-url="${ version.urls.documentation }">
90+
${ version.slug }
91+
</option>`
92+
).join("\n") }
93+
</select>
94+
`;
95+
96+
// Prepend the current language to the options on the selector
97+
let languages = config.projects.translations.concat(config.projects.current);
98+
languages = languages.sort((a, b) => a.language.name.localeCompare(b.language.name));
99+
100+
const languageSelect = `
101+
<select id="language_select">
102+
${ languages.map(
103+
(translation) => `
104+
<option
105+
value="${ translation.slug }"
106+
${ config.projects.current.slug === translation.slug ? 'selected="selected"' : '' }
107+
data-url="${ translation.urls.documentation }">
108+
${ translation.language.name }
109+
</option>`
110+
).join("\n") }
111+
</select>
112+
`;
113+
114+
// Query all the placeholders because there are different ones for Desktop/Mobile
115+
const versionPlaceholders = document.querySelectorAll(".version_switcher_placeholder");
116+
for (placeholder of versionPlaceholders) {
117+
placeholder.innerHTML = versionSelect;
118+
let selectElement = placeholder.querySelector("select");
119+
selectElement.addEventListener("change", onSwitch);
120+
}
121+
122+
const languagePlaceholders = document.querySelectorAll(".language_switcher_placeholder");
123+
for (placeholder of languagePlaceholders) {
124+
placeholder.innerHTML = languageSelect;
125+
let selectElement = placeholder.querySelector("select");
126+
selectElement.addEventListener("change", onSwitch);
127+
}
128+
});
129+
</script>
44130
{% endblock %}

Doc/whatsnew/3.13.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,6 +1621,11 @@ Build Changes
16211621
* ``wasm32-emscripten`` is no longer a :pep:`11` supported platform.
16221622
(Contributed by Brett Cannon in :gh:`115192`.)
16231623

1624+
* Python now bundles the `mimalloc library <https://github.com/microsoft/mimalloc>`__.
1625+
It is licensed under the MIT license, see :ref:`mimalloc license <mimalloc-license>`.
1626+
The bundled mimalloc has custom changes, see :gh:`113141` for details.
1627+
(Contributed by Dino Viehland in :gh:`109914`.)
1628+
16241629

16251630
C API Changes
16261631
=============

Include/internal/pycore_global_objects_fini_generated.h

Lines changed: 4 additions & 0 deletions
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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ struct _Py_global_strings {
353353
STRUCT_FOR_ID(co_stacksize)
354354
STRUCT_FOR_ID(co_varnames)
355355
STRUCT_FOR_ID(code)
356+
STRUCT_FOR_ID(col_offset)
356357
STRUCT_FOR_ID(command)
357358
STRUCT_FOR_ID(comment_factory)
358359
STRUCT_FOR_ID(compile_mode)
@@ -402,6 +403,7 @@ struct _Py_global_strings {
402403
STRUCT_FOR_ID(encode)
403404
STRUCT_FOR_ID(encoding)
404405
STRUCT_FOR_ID(end)
406+
STRUCT_FOR_ID(end_col_offset)
405407
STRUCT_FOR_ID(end_lineno)
406408
STRUCT_FOR_ID(end_offset)
407409
STRUCT_FOR_ID(endpos)
@@ -522,6 +524,7 @@ struct _Py_global_strings {
522524
STRUCT_FOR_ID(kw1)
523525
STRUCT_FOR_ID(kw2)
524526
STRUCT_FOR_ID(kwdefaults)
527+
STRUCT_FOR_ID(label)
525528
STRUCT_FOR_ID(lambda)
526529
STRUCT_FOR_ID(last)
527530
STRUCT_FOR_ID(last_exc)
@@ -585,6 +588,7 @@ struct _Py_global_strings {
585588
STRUCT_FOR_ID(namespaces)
586589
STRUCT_FOR_ID(narg)
587590
STRUCT_FOR_ID(ndigits)
591+
STRUCT_FOR_ID(nested)
588592
STRUCT_FOR_ID(new_file_name)
589593
STRUCT_FOR_ID(new_limit)
590594
STRUCT_FOR_ID(newline)

Include/internal/pycore_instruction_sequence.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
# error "this header requires Py_BUILD_CORE define"
66
#endif
77

8+
#include "pycore_symtable.h"
9+
810
#ifdef __cplusplus
911
extern "C" {
1012
#endif
1113

14+
1215
typedef struct {
1316
int h_label;
1417
int h_startdepth;
@@ -26,23 +29,30 @@ typedef struct {
2629
int i_offset;
2730
} _PyInstruction;
2831

29-
typedef struct {
32+
typedef struct instruction_sequence {
33+
PyObject_HEAD
3034
_PyInstruction *s_instrs;
3135
int s_allocated;
3236
int s_used;
3337

3438
int s_next_free_label; /* next free label id */
39+
3540
/* Map of a label id to instruction offset (index into s_instrs).
3641
* If s_labelmap is NULL, then each label id is the offset itself.
3742
*/
38-
int *s_labelmap; /* label id --> instr offset */
43+
int *s_labelmap;
3944
int s_labelmap_size;
45+
46+
/* PyList of instruction sequences of nested functions */
47+
PyObject *s_nested;
4048
} _PyInstructionSequence;
4149

4250
typedef struct {
4351
int id;
4452
} _PyJumpTargetLabel;
4553

54+
PyAPI_FUNC(PyObject*)_PyInstructionSequence_New(void);
55+
4656
int _PyInstructionSequence_UseLabel(_PyInstructionSequence *seq, int lbl);
4757
int _PyInstructionSequence_Addop(_PyInstructionSequence *seq,
4858
int opcode, int oparg,
@@ -53,6 +63,8 @@ int _PyInstructionSequence_InsertInstruction(_PyInstructionSequence *seq, int po
5363
int opcode, int oparg, _Py_SourceLocation loc);
5464
void PyInstructionSequence_Fini(_PyInstructionSequence *seq);
5565

66+
extern PyTypeObject _PyInstructionSequence_Type;
67+
#define _PyInstructionSequence_Check(v) Py_IS_TYPE((v), &_PyInstructionSequence_Type)
5668

5769
#ifdef __cplusplus
5870
}

Include/internal/pycore_runtime_init_generated.h

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

Include/internal/pycore_unicodeobject_generated.h

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

Lib/email/message.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ def get_payload(self, i=None, decode=False):
294294
try:
295295
bpayload = payload.encode('ascii', 'surrogateescape')
296296
try:
297-
payload = bpayload.decode(self.get_param('charset', 'ascii'), 'replace')
297+
payload = bpayload.decode(self.get_content_charset('ascii'), 'replace')
298298
except LookupError:
299299
payload = bpayload.decode('ascii', 'replace')
300300
except UnicodeEncodeError:

Lib/posixpath.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ def commonpath(paths):
550550
split_paths = [path.split(sep) for path in paths]
551551

552552
try:
553-
isabs, = set(p[:1] == sep for p in paths)
553+
isabs, = {p.startswith(sep) for p in paths}
554554
except ValueError:
555555
raise ValueError("Can't mix absolute and relative paths") from None
556556

0 commit comments

Comments
 (0)