Skip to content

Commit ef2b42f

Browse files
committed
Merge branch 'main' into const_char
2 parents f2ab865 + a0e77f2 commit ef2b42f

55 files changed

Lines changed: 3716 additions & 1157 deletions

Some content is hidden

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

Doc/extending/extending.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,7 @@ Finally it should be mentioned that Capsules offer additional functionality,
11061106
which is especially useful for memory allocation and deallocation of the pointer
11071107
stored in a Capsule. The details are described in the Python/C API Reference
11081108
Manual in the section :ref:`capsules` and in the implementation of Capsules (files
1109-
:file:`Include/pycapsule.h` and :file:`Objects/pycapsule.c` in the Python source
1109+
:file:`Include/pycapsule.h` and :file:`Objects/capsule.c` in the Python source
11101110
code distribution).
11111111

11121112
.. rubric:: Footnotes

Doc/library/compression.zstd.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ Compressing and decompressing data in memory
346346
will be set to ``True``.
347347

348348
Attempting to decompress data after the end of a frame will raise a
349-
:exc:`ZstdError`. Any data found after the end of the frame is ignored
349+
:exc:`EOFError`. Any data found after the end of the frame is ignored
350350
and saved in the :attr:`~.unused_data` attribute.
351351

352352
.. attribute:: eof

Doc/library/io.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,10 +763,13 @@ than raw I/O does.
763763

764764
.. note::
765765
As long as the view exists, the :class:`BytesIO` object cannot be
766-
resized or closed.
766+
resized. Closing it does not invalidate the view.
767767

768768
.. versionadded:: 3.2
769769

770+
.. versionchanged:: next
771+
The :class:`BytesIO` object can now be closed while the view exists.
772+
770773
.. method:: getvalue()
771774

772775
Return :class:`bytes` containing the entire contents of the buffer.

Doc/library/os.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,10 +1011,14 @@ as internal buffering of data.
10111011
It will always copy no bytes and return 0 as if the file was empty
10121012
because of a known Linux kernel issue.
10131013

1014-
.. availability:: Linux >= 4.5 with glibc >= 2.27.
1014+
.. availability:: Linux >= 4.5.
10151015

10161016
.. versionadded:: 3.8
10171017

1018+
.. versionchanged:: 3.16
1019+
The function is now also available when Python is built against a libc
1020+
that lacks ``copy_file_range()``, such as glibc older than 2.27.
1021+
10181022

10191023
.. function:: device_encoding(fd)
10201024

@@ -4400,10 +4404,14 @@ The following flags are used in :attr:`statvfs_result.f_flag`.
44004404
the file descriptor, and as such multiple files can have the same name
44014405
without any side effects.
44024406

4403-
.. availability:: Linux >= 3.17 with glibc >= 2.27.
4407+
.. availability:: Linux >= 3.17.
44044408

44054409
.. versionadded:: 3.8
44064410

4411+
.. versionchanged:: 3.16
4412+
The function is now also available when Python is built against a libc
4413+
that lacks ``memfd_create()``, such as glibc older than 2.27.
4414+
44074415

44084416
.. data:: MFD_CLOEXEC
44094417
MFD_ALLOW_SEALING

Doc/library/sqlite3.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,6 +1760,10 @@ Blob objects
17601760

17611761
.. versionadded:: 3.11
17621762

1763+
.. versionchanged:: next
1764+
:class:`Blob` now supports negative-step slices
1765+
(e.g. ``blob[9:0:-2]``) for both reading and writing.
1766+
17631767
A :class:`Blob` instance is a :term:`file-like object`
17641768
that can read and write data in an SQLite :abbr:`BLOB (Binary Large OBject)`.
17651769
Call :func:`len(blob) <len>` to get the size (number of bytes) of the blob.

Doc/library/sys.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1941,7 +1941,7 @@ always available. Unless explicitly noted otherwise, all variables are read-only
19411941
The interpreter is about to execute a new line of code or re-execute the
19421942
condition of a loop. The local trace function is called; *arg* is
19431943
``None``; the return value specifies the new local trace function. See
1944-
:file:`Objects/lnotab_notes.txt` for a detailed explanation of how this
1944+
:source:`InternalDocs/code_objects.md` for a detailed explanation of how this
19451945
works.
19461946
Per-line events may be disabled for a frame by setting
19471947
:attr:`~frame.f_trace_lines` to :const:`False` on that

Doc/using/android.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ much easier experience:
3737
* `Termux <https://termux.dev/en/>`__
3838

3939
If you're sure you want to do all of this manually, read on. You can use the
40-
:source:`testbed app <Android/testbed>` as a guide; each step below contains a
40+
:source:`testbed app <Platforms/Android/testbed>` as a guide; each step below contains a
4141
link to the relevant file.
4242

4343
* First, acquire a build of Python for Android:
@@ -47,10 +47,10 @@ link to the relevant file.
4747
mentioned below is at the top level of the package.
4848

4949
* Or if you want to build it yourself, follow the instructions in
50-
:source:`Android/README.md`. The ``prefix`` directory will be created under
50+
:source:`Platforms/Android/README.md`. The ``prefix`` directory will be created under
5151
:samp:`cross-build/{HOST}`.
5252

53-
* Add code to your :source:`build.gradle <Android/testbed/app/build.gradle.kts>`
53+
* Add code to your :source:`build.gradle <Platforms/Android/testbed/app/build.gradle.kts>`
5454
file to copy the following items into your project. All except your own Python
5555
code can be copied from ``prefix/lib``:
5656

@@ -65,10 +65,10 @@ link to the relevant file.
6565
* ``python*.*/site-packages`` (your own Python code)
6666

6767
* Add code to your app to :source:`extract the assets to the filesystem
68-
<Android/testbed/app/src/main/java/org/python/testbed/MainActivity.kt>`.
68+
<Platforms/Android/testbed/app/src/main/java/org/python/testbed/MainActivity.kt>`.
6969

7070
* Add code to your app to :source:`start Python in embedded mode
71-
<Android/testbed/app/src/main/c/main_activity.c>`. This will need to be C code
71+
<Platforms/Android/testbed/app/src/main/c/main_activity.c>`. This will need to be C code
7272
called via JNI.
7373

7474
Building a Python package for Android

Doc/using/configure.rst

Lines changed: 70 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ Dependencies to build optional modules are:
7171
* - Dependency
7272
- Minimum version
7373
- Python module
74-
* - `libbz2 <https://sourceware.org/bzip2/>`_
74+
* - `libbz2 <https://sourceware.org/bzip2/>`_ or
75+
`libbzip2-rs <https://github.com/trifectatechfoundation/libbzip2-rs>`_ [1]_
7576
-
7677
- :mod:`bz2`
7778
* - `libffi <https://sourceware.org/libffi/>`_
@@ -82,47 +83,54 @@ Dependencies to build optional modules are:
8283
- :mod:`lzma`
8384
* - `libmpdec <https://www.bytereef.org/mpdecimal/doc/libmpdec/>`_
8485
- 2.5.0
85-
- :mod:`decimal` [1]_
86+
- :mod:`decimal` [2]_
8687
* - `libreadline <https://tiswww.case.edu/php/chet/readline/rltop.html>`_ or
87-
`libedit <https://www.thrysoee.dk/editline/>`_ [2]_
88+
`libedit <https://www.thrysoee.dk/editline/>`_ [3]_
8889
-
8990
- :mod:`readline`
9091
* - `libuuid <https://linux.die.net/man/3/libuuid>`_
9192
-
92-
- ``_uuid`` [3]_
93-
* - `ncurses <https://gnu.org/software/ncurses/ncurses.html>`_ [4]_
93+
- ``_uuid`` [4]_
94+
* - `ncurses <https://gnu.org/software/ncurses/ncurses.html>`_ [5]_
9495
-
9596
- :mod:`curses`
9697
* - `OpenSSL <https://openssl-library.org/>`_
9798
- | 3.0.18 recommended
9899
| (1.1.1 minimum)
99-
- :mod:`ssl`, :mod:`hashlib` [5]_
100+
- :mod:`ssl`, :mod:`hashlib` [6]_
100101
* - `SQLite <https://sqlite.org/>`_
101102
- 3.15.2
102103
- :mod:`sqlite3`
103104
* - `Tcl/Tk <https://www.tcl-lang.org/>`_
104105
- 8.5.12
105106
- :mod:`tkinter`, :ref:`IDLE <idle>`, :mod:`turtle`
106-
* - `zlib <https://www.zlib.net>`_
107-
- 1.2.2.1
107+
* - `zlib <https://www.zlib.net>`_,
108+
`zlib-ng <https://github.com/zlib-ng/zlib-ng>`_, or
109+
`zlib-rs <https://github.com/trifectatechfoundation/zlib-rs/>`_ [7]_
110+
- | 1.2.2.1 (zlib, zlib-ng)
111+
| 0.6.0 (zlib-rs)
108112
- :mod:`zlib`, :mod:`gzip`, :mod:`ensurepip`
109113
* - `zstd <https://facebook.github.io/zstd/>`_
110114
- 1.4.5
111115
- :mod:`compression.zstd`
112116

113-
.. [1] If *libmpdec* is not available, the :mod:`decimal` module will use
117+
.. [1] See :option:`--with-bzip2` for choosing the backend for the
118+
:mod:`bz2` module.
119+
.. [2] If *libmpdec* is not available, the :mod:`decimal` module will use
114120
a pure-Python implementation.
115-
.. [2] See :option:`--with-readline` for choosing the backend for the
121+
.. [3] See :option:`--with-readline` for choosing the backend for the
116122
:mod:`readline` module.
117-
.. [3] The :mod:`uuid` module uses ``_uuid`` to generate "safe" UUIDs.
123+
.. [4] The :mod:`uuid` module uses ``_uuid`` to generate "safe" UUIDs.
118124
See the module documentation for details.
119-
.. [4] The :mod:`curses` module requires the ``libncurses`` or ``libncursesw``
125+
.. [5] The :mod:`curses` module requires the ``libncurses`` or ``libncursesw``
120126
library.
121127
The :mod:`curses.panel` module additionally requires the ``libpanel`` or
122128
``libpanelw`` library.
123-
.. [5] If OpenSSL is not available, the :mod:`hashlib` module will use
129+
.. [6] If OpenSSL is not available, the :mod:`hashlib` module will use
124130
bundled implementations of several hash functions.
125131
See :option:`--with-builtin-hashlib-hashes` for *forcing* usage of OpenSSL.
132+
.. [7] See :option:`--with-zlib` for choosing the backend for the
133+
:mod:`zlib` module.
126134
127135
Note that the table does not include all optional modules; in particular,
128136
platform-specific modules like :mod:`winreg` are not listed here.
@@ -1113,6 +1121,54 @@ Libraries options
11131121

11141122
.. versionadded:: next
11151123

1124+
.. option:: --with-zlib=zlib|zlib-ng|zlib-rs
1125+
1126+
Designate the zlib implementation to build the :mod:`zlib` module against.
1127+
1128+
* ``zlib``: Use the system zlib library, found via ``pkg-config`` or as
1129+
``libz``.
1130+
* ``zlib-ng``: Same detection as ``zlib``, but fail unless the detected
1131+
library is `zlib-ng <https://github.com/zlib-ng/zlib-ng>`__.
1132+
* ``zlib-rs``: Use `zlib-rs
1133+
<https://github.com/trifectatechfoundation/zlib-rs/>`__, found via
1134+
``pkg-config`` as ``libz_rs``.
1135+
1136+
Without this option (or with ``--with-zlib=auto``, the default), the system
1137+
zlib is used when found; configure only fails when an implementation was
1138+
requested explicitly but cannot be found.
1139+
1140+
.. versionadded:: next
1141+
1142+
.. option:: --without-zlib
1143+
1144+
Don't build the :mod:`zlib` module, even when a zlib library is present
1145+
(built by default when one is found).
1146+
1147+
.. versionadded:: next
1148+
1149+
.. option:: --with-bzip2=bzip2|bzip2-rs
1150+
1151+
Designate the bzip2 implementation to build the :mod:`bz2` module against.
1152+
1153+
* ``bzip2``: Use the system bzip2 library, found via ``pkg-config`` or as
1154+
``libbz2``.
1155+
* ``bzip2-rs``: Use `libbzip2-rs
1156+
<https://github.com/trifectatechfoundation/libbzip2-rs>`__, found via
1157+
``pkg-config`` as ``libbz2_rs``.
1158+
1159+
Without this option (or with ``--with-bzip2=auto``, the default), the
1160+
system bzip2 is used when found; configure only fails when an
1161+
implementation was requested explicitly but cannot be found.
1162+
1163+
.. versionadded:: next
1164+
1165+
.. option:: --without-bzip2
1166+
1167+
Don't build the :mod:`bz2` module, even when a bzip2 library is present
1168+
(built by default when one is found).
1169+
1170+
.. versionadded:: next
1171+
11161172
.. option:: --with-libm=STRING
11171173

11181174
Override ``libm`` math library to *STRING* (default is system-dependent).
@@ -1275,7 +1331,7 @@ See :source:`Mac/README.rst`.
12751331
iOS Options
12761332
-----------
12771333

1278-
See :source:`iOS/README.rst`.
1334+
See :source:`Platforms/Apple/iOS/README.md`.
12791335

12801336
.. option:: --enable-framework=INSTALLDIR
12811337

Doc/using/ios.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ helpful.
170170
To add Python to an iOS Xcode project:
171171

172172
1. Build or obtain a Python ``XCFramework``. See the instructions in
173-
:source:`Apple/iOS/README.md` (in the CPython source distribution) for details on
173+
:source:`Platforms/Apple/iOS/README.md` (in the CPython source distribution) for details on
174174
how to build a Python ``XCFramework``. At a minimum, you will need a build
175175
that supports ``arm64-apple-ios``, plus one of either
176176
``arm64-apple-ios-simulator`` or ``x86_64-apple-ios-simulator``.
@@ -266,13 +266,13 @@ modules in your app, some additional steps will be required:
266266
Testing a Python package
267267
------------------------
268268

269-
The CPython source tree contains :source:`a testbed project <Apple/iOS/testbed>` that
269+
The CPython source tree contains :source:`a testbed project <Platforms/Apple/testbed>` that
270270
is used to run the CPython test suite on the iOS simulator. This testbed can also
271271
be used as a testbed project for running your Python library's test suite on iOS.
272272

273-
After building or obtaining an iOS XCFramework (see :source:`Apple/iOS/README.md`
273+
After building or obtaining an iOS XCFramework (see :source:`Platforms/Apple/iOS/README.md`
274274
for details), create a clone of the Python iOS testbed project. If you used the
275-
``Apple`` build script to build the XCframework, you can run:
275+
``Platforms/Apple`` build script to build the XCframework, you can run:
276276

277277
.. code-block:: bash
278278
@@ -282,7 +282,7 @@ Or, if you've sourced your own XCframework, by running:
282282

283283
.. code-block:: bash
284284
285-
$ python Apple/testbed clone --platform iOS --framework <path/to/Python.xcframework> --app <path/to/module1> --app <path/to/module2> app-testbed
285+
$ python Platforms/Apple/testbed clone --platform iOS --framework <path/to/Python.xcframework> --app <path/to/module1> --app <path/to/module2> app-testbed
286286
287287
Any folders specified with the ``--app`` flag will be copied into the cloned
288288
testbed project. The resulting testbed will be created in the ``app-testbed``

Doc/whatsnew/3.16.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,13 @@ shlex
466466
a string, even if it is already safe for a shell without being quoted.
467467
(Contributed by Jay Berry in :gh:`148846`.)
468468

469+
sqlite3
470+
-------
471+
472+
* :class:`sqlite3.Blob` now supports negative-step slices for reading and
473+
writing (e.g. ``blob[9:0:-2]``). Previously, such slices would raise
474+
:exc:`SystemError` or :exc:`ValueError`.
475+
(Contributed by Jiseok CHOI in :gh:`150449`.)
469476

470477
symtable
471478
--------
@@ -870,6 +877,18 @@ Build changes
870877

871878
(Contributed by Serhiy Storchaka in :gh:`136687`.)
872879

880+
* Add the :option:`--with-zlib` and :option:`--with-bzip2` :program:`configure`
881+
options to select the zlib and bzip2 implementations used to build the
882+
:mod:`zlib` and :mod:`bz2` modules. In addition to the default system
883+
libraries, they can build against `zlib-rs
884+
<https://github.com/trifectatechfoundation/zlib-rs/>`__ and `libbzip2-rs
885+
<https://github.com/trifectatechfoundation/libbzip2-rs>`__, and
886+
``--with-zlib=zlib-ng`` verifies that the detected zlib is `zlib-ng
887+
<https://github.com/zlib-ng/zlib-ng>`__. :option:`--without-zlib` and
888+
:option:`--without-bzip2` exclude the modules from the build.
889+
890+
(Contributed by Stan Ulbrych in :gh:`139314`.)
891+
873892

874893
C API changes
875894
=============

0 commit comments

Comments
 (0)