Skip to content

Commit 006b77c

Browse files
authored
Merge branch 'python:main' into sem-macosx-multiprocessing-module-C
2 parents c8a7fbb + a704832 commit 006b77c

File tree

174 files changed

+7520
-3517
lines changed

Some content is hidden

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

174 files changed

+7520
-3517
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ Lib/test/test_stable_abi_ctypes.py generated
9494
Lib/test/test_zoneinfo/data/*.json generated
9595
Lib/token.py generated
9696
Misc/sbom.spdx.json generated
97+
Modules/_testinternalcapi/test_cases.c.h generated
98+
Modules/_testinternalcapi/test_targets.h generated
9799
Objects/typeslots.inc generated
98100
PC/python3dll.c generated
99101
Parser/parser.c generated

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ Tools/wasm/config.site-wasm32-emscripten @freakboy3742 @emmatyping
176176
Tools/wasm/emscripten @freakboy3742 @emmatyping
177177

178178
# WebAssembly (WASI)
179+
Platforms/WASI @brettcannon @emmatyping @savannahostrowski
179180
Tools/wasm/wasi-env @brettcannon @emmatyping @savannahostrowski
180181
Tools/wasm/wasi.py @brettcannon @emmatyping @savannahostrowski
181182
Tools/wasm/wasi @brettcannon @emmatyping @savannahostrowski

.github/workflows/reusable-wasi.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ jobs:
4747
- name: "Runner image version"
4848
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
4949
- name: "Configure build Python"
50-
run: python3 Tools/wasm/wasi configure-build-python -- --config-cache --with-pydebug
50+
run: python3 Platforms/WASI configure-build-python -- --config-cache --with-pydebug
5151
- name: "Make build Python"
52-
run: python3 Tools/wasm/wasi make-build-python
52+
run: python3 Platforms/WASI make-build-python
5353
- name: "Configure host"
5454
# `--with-pydebug` inferred from configure-build-python
55-
run: python3 Tools/wasm/wasi configure-host -- --config-cache
55+
run: python3 Platforms/WASI configure-host -- --config-cache
5656
- name: "Make host"
57-
run: python3 Tools/wasm/wasi make-host
57+
run: python3 Platforms/WASI make-host
5858
- name: "Display build info"
5959
run: make --directory "${CROSS_BUILD_WASI}" pythoninfo
6060
- name: "Test"

Android/testbed/app/build.gradle.kts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,12 @@ android {
9292
}
9393
throw GradleException("Failed to find API level in $androidEnvFile")
9494
}
95-
targetSdk = 35
95+
96+
// This controls the API level of the maxVersion managed emulator, which is used
97+
// by CI and cibuildwheel. 34 takes up too much disk space (#142289), 35 has
98+
// issues connecting to the internet (#142387), and 36 and later are not
99+
// available as aosp_atd images yet.
100+
targetSdk = 33
96101

97102
versionCode = 1
98103
versionName = "1.0"

Doc/c-api/conversion.rst

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ The following functions provide locale-independent string to number conversions.
130130
131131
*flags* can be zero or more of the following values or-ed together:
132132
133+
.. c:namespace:: NULL
134+
133135
.. c:macro:: Py_DTSF_SIGN
134136
135137
Always precede the returned string with a sign
@@ -151,9 +153,21 @@ The following functions provide locale-independent string to number conversions.
151153
152154
.. versionadded:: 3.11
153155
154-
If *ptype* is non-``NULL``, then the value it points to will be set to one of
155-
``Py_DTST_FINITE``, ``Py_DTST_INFINITE``, or ``Py_DTST_NAN``, signifying that
156-
*val* is a finite number, an infinite number, or not a number, respectively.
156+
If *ptype* is non-``NULL``, then the value it points to will be set to one
157+
of the following constants depending on the type of *val*:
158+
159+
.. list-table::
160+
:header-rows: 1
161+
:align: left
162+
163+
* - *\*ptype*
164+
- type of *val*
165+
* - .. c:macro:: Py_DTST_FINITE
166+
- finite number
167+
* - .. c:macro:: Py_DTST_INFINITE
168+
- infinite number
169+
* - .. c:macro:: Py_DTST_NAN
170+
- not a number
157171
158172
The return value is a pointer to *buffer* with the converted string or
159173
``NULL`` if the conversion failed. The caller is responsible for freeing the

Doc/c-api/memory.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,11 @@ The pymalloc allocator
677677
Python has a *pymalloc* allocator optimized for small objects (smaller or equal
678678
to 512 bytes) with a short lifetime. It uses memory mappings called "arenas"
679679
with a fixed size of either 256 KiB on 32-bit platforms or 1 MiB on 64-bit
680-
platforms. It falls back to :c:func:`PyMem_RawMalloc` and
680+
platforms. When Python is configured with :option:`--with-pymalloc-hugepages`,
681+
the arena size on 64-bit platforms is increased to 2 MiB to match the huge page
682+
size, and arena allocation will attempt to use huge pages (``MAP_HUGETLB`` on
683+
Linux, ``MEM_LARGE_PAGES`` on Windows) with automatic fallback to regular pages.
684+
It falls back to :c:func:`PyMem_RawMalloc` and
681685
:c:func:`PyMem_RawRealloc` for allocations larger than 512 bytes.
682686
683687
*pymalloc* is the :ref:`default allocator <default-memory-allocators>` of the

Doc/c-api/module.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -426,10 +426,10 @@ To retrieve the state from a given module, use the following functions:
426426
module state.
427427
428428
429-
.. c:function:: int PyModule_GetStateSize(PyObject *, Py_ssize_t *result)
429+
.. c:function:: int PyModule_GetStateSize(PyObject *module, Py_ssize_t *result)
430430
431-
Set *\*result* to the size of the module's state, as specified using
432-
:c:macro:`Py_mod_state_size` (or :c:member:`PyModuleDef.m_size`),
431+
Set *\*result* to the size of *module*'s state, as specified
432+
using :c:macro:`Py_mod_state_size` (or :c:member:`PyModuleDef.m_size`),
433433
and return 0.
434434
435435
On error, set *\*result* to -1, and return -1 with an exception set.
@@ -597,7 +597,7 @@ A module's token -- and the *your_token* value to use in the above code -- is:
597597
598598
.. c:function:: int PyModule_GetToken(PyObject *module, void** result)
599599
600-
Set *\*result* to the module's token and return 0.
600+
Set *\*result* to the module token for *module* and return 0.
601601
602602
On error, set *\*result* to NULL, and return -1 with an exception set.
603603
@@ -645,7 +645,7 @@ rather than from an extension's :ref:`export hook <extension-export-hook>`.
645645
646646
.. c:function:: int PyModule_Exec(PyObject *module)
647647
648-
Execute the :c:data:`Py_mod_exec` slot(s) of the given *module*.
648+
Execute the :c:data:`Py_mod_exec` slot(s) of *module*.
649649
650650
On success, return 0.
651651
On error, return -1 with an exception set.
@@ -1021,6 +1021,9 @@ or code that creates modules dynamically.
10211021
``PyModuleDef`` (such as when using :ref:`multi-phase-initialization`,
10221022
``PyModule_Create``, or ``PyModule_FromDefAndSpec``).
10231023
1024+
Return ``0`` on success.
1025+
Return ``-1`` with an exception set on error.
1026+
10241027
.. versionadded:: 3.5
10251028
10261029
.. c:function:: int PyUnstable_Module_SetGIL(PyObject *module, void *gil)

Doc/faq/programming.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,13 +1226,13 @@ This converts the list into a set, thereby removing duplicates, and then back
12261226
into a list.
12271227

12281228

1229-
How do you remove multiple items from a list
1230-
--------------------------------------------
1229+
How do you remove multiple items from a list?
1230+
---------------------------------------------
12311231

12321232
As with removing duplicates, explicitly iterating in reverse with a
12331233
delete condition is one possibility. However, it is easier and faster
12341234
to use slice replacement with an implicit or explicit forward iteration.
1235-
Here are three variations.::
1235+
Here are three variations::
12361236

12371237
mylist[:] = filter(keep_function, mylist)
12381238
mylist[:] = (x for x in mylist if keep_condition)

Doc/howto/remote_debugging.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ execute Python code remotely.
88

99
Most platforms require elevated privileges to attach to another Python process.
1010

11+
Disabling remote debugging
12+
--------------------------
13+
14+
To disable remote debugging support, use any of the following:
15+
16+
* Set the :envvar:`PYTHON_DISABLE_REMOTE_DEBUG` environment variable to ``1`` before
17+
starting the interpreter.
18+
* Use the :option:`-X disable_remote_debug` command-line option.
19+
* Compile Python with the :option:`--without-remote-debug` build flag.
20+
1121
.. _permission-requirements:
1222

1323
Permission requirements
@@ -614,4 +624,3 @@ To inject and execute a Python script in a remote process:
614624
6. Set ``_PY_EVAL_PLEASE_STOP_BIT`` in the ``eval_breaker`` field.
615625
7. Resume the process (if suspended). The script will execute at the next safe
616626
evaluation point.
617-

Doc/library/base64.rst

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ POST request.
7373

7474

7575
.. function:: b64decode(s, altchars=None, validate=False)
76+
b64decode(s, altchars=None, validate=True, *, ignorechars)
7677
7778
Decode the Base64 encoded :term:`bytes-like object` or ASCII string
7879
*s* and return the decoded :class:`bytes`.
@@ -84,11 +85,17 @@ POST request.
8485
A :exc:`binascii.Error` exception is raised
8586
if *s* is incorrectly padded.
8687

87-
If *validate* is false (the default), characters that are neither
88+
If *ignorechars* is specified, it should be a :term:`bytes-like object`
89+
containing characters to ignore from the input when *validate* is true.
90+
The default value of *validate* is ``True`` if *ignorechars* is specified,
91+
``False`` otherwise.
92+
93+
If *validate* is false, characters that are neither
8894
in the normal base-64 alphabet nor the alternative alphabet are
8995
discarded prior to the padding check, but the ``+`` and ``/`` characters
9096
keep their meaning if they are not in *altchars* (they will be discarded
9197
in future Python versions).
98+
9299
If *validate* is true, these non-alphabet characters in the input
93100
result in a :exc:`binascii.Error`.
94101

@@ -99,6 +106,10 @@ POST request.
99106
is now deprecated.
100107

101108

109+
.. versionchanged:: next
110+
Added the *ignorechars* parameter.
111+
112+
102113
.. function:: standard_b64encode(s)
103114

104115
Encode :term:`bytes-like object` *s* using the standard Base64 alphabet
@@ -254,8 +265,7 @@ Refer to the documentation of the individual functions for more information.
254265
*adobe* controls whether the input sequence is in Adobe Ascii85 format
255266
(i.e. is framed with <~ and ~>).
256267

257-
*ignorechars* should be a :term:`bytes-like object` or ASCII string
258-
containing characters to ignore
268+
*ignorechars* should be a byte string containing characters to ignore
259269
from the input. This should only contain whitespace characters, and by
260270
default contains all whitespace characters in ASCII.
261271

0 commit comments

Comments
 (0)