Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
1f13740
gh-154001: Avoid division by zero in binomialvariate (GH-154004)
lkk7 Jul 19, 2026
3c274d0
gh-136687: Add ./configure --with-curses to select the curses backend…
serhiy-storchaka Jul 19, 2026
33df37d
gh-154048: Fix building the iconv codec on illumos/Solaris (GH-154049)
serhiy-storchaka Jul 19, 2026
a83aaa9
gh-153862: Fix curses window.inch() for non-ASCII characters on a wid…
serhiy-storchaka Jul 19, 2026
4b60b46
fix typos in `abi3t-migration.rst` (GH-153918)
JostMigenda Jul 19, 2026
9f5af27
Test that `ValueError` is raised when `vfsopen` is passed an invalid …
ravg998 Jul 19, 2026
223cbff
gh-153864: Fix curses window.insch() for non-ASCII characters on a wi…
serhiy-storchaka Jul 19, 2026
30541f2
Fix typo "interruptability" in Logging Cookbook documentation (#154027)
michaelbnewman Jul 19, 2026
39b058f
gh-154053: Fix compilation of the ssl module against LibreSSL (GH-154…
serhiy-storchaka Jul 19, 2026
54b00c0
Improve colorsys coverage (#153982)
MonadChains Jul 19, 2026
426cf84
Docs: add frozendict to data types theme (#154063)
rodrigogiraoserrao Jul 19, 2026
cae8ec8
gh-153906: Modernize pydoc HTML output (GH-153909)
serhiy-storchaka Jul 19, 2026
d5eb312
gh-153903: Fix ctypes wrap_dll_function() with string annotations (#1…
vstinner Jul 19, 2026
8367448
gh-104533: Fix `@ctypes.util.struct` with string annotations (#154040)
vstinner Jul 19, 2026
e260051
gh-104533: Fix `@ctypes.util.struct` with endian (#154038)
vstinner Jul 19, 2026
16562f1
Document getopt and gnu_getopt longopts argument as string (#153976)
flofriday Jul 19, 2026
20b50f8
gh-104533: Update test_ctypes.test_structures (#154091)
vstinner Jul 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions Doc/howto/abi3t-migration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ Migrating to Stable ABI for free threading (``abi3t``)

Starting with the 3.15 release, CPython supports a variant of the Stable ABI
that supports :term:`free-threaded <free threading>` Python:
Stable ABI for Free-Threaded Builds, or ``abi3t`` for short.
the Stable ABI for Free-Threaded Builds, or ``abi3t`` for short.
This document describes how to adapt C API extensions to support free threading.

Why do this
===========

The typical reason to use Stable ABI is to reduce the number of artifacts that
you need to build and distribute for each version of your library.
The typical reason to use the Stable ABI is to reduce the number of artifacts
that you need to build and distribute for each version of your library.

Without the Stable ABI, you must build a separate shared library, and typically
a *wheel* distribution, for each feature version of CPython you wish
Expand Down Expand Up @@ -87,16 +87,16 @@ builds; even the 3.15+ ones that this table "attributes" to ``abi3t``.)
Why *not* do this
-----------------

There are two main downsides to Stable ABI.
There are two main downsides to the Stable ABI.

First, you extension may become slower, since Stable ABI prioritizes
First, your extension may become slower, since the Stable ABI prioritizes
compatibility over performance.
The difference is usually not noticeable, and often can be mitigated by
using the same source to build both a Stable ABI build and a few
version-specific ones for "tier 1" CPython versions.

Second, not all of the C API is available.
Extensions need to be ported to build for Stable ABI, which may be difficult
Extensions need to be ported to build for the Stable ABI, which may be difficult
or, in rare cases, impossible.

Specifically, ``abi3t`` requires APIs added in CPython 3.15.
Expand Down Expand Up @@ -127,15 +127,15 @@ Prerequisites
This guide assumes that you have an extension written directly in C (or C++),
which you want to port to ``abi3t``.

If your extenstion uses a code generator (like Cython) or language binding
If your extension uses a code generator (like Cython) or language binding
(like PyO3), it's best to wait until that tool has support for ``abi3t``.
If you maintain such a tool, you might be able to adapt the instructions
here for your tool.

Non-free-threaded Stable ABI
----------------------------

Your extension should support the Stable ABI (``abi3t``).
Your extension should support the non-free-threaded Stable ABI (``abi3``).
If not, either port it first, or follow this guide but be prepared to fix
issues it does not mention.

Expand Down Expand Up @@ -183,7 +183,7 @@ following just after ``#include <Python.h>``::
#error "abi3t define is not set!"
#endif

This should result in a different error than "``abt3t`` define is not set".
This should result in a different error than "``abi3t`` define is not set".

.. note::

Expand Down Expand Up @@ -705,7 +705,7 @@ Testing
Note that when you build an extension compatible with multiple versions of
CPython, you should always *test* it with each version it supports (for
example, 3.15, 3.16, and so on).
Stable ABI only guarantees *ABI* compatibility; there may also be behavior
The Stable ABI only guarantees *ABI* compatibility; there may also be behavior
changes -- both intentional ones (covered by :pep:`387`) and bugs.

Be sure to run tests on both free-threaded and non-free-threaded builds
Expand Down
2 changes: 1 addition & 1 deletion Doc/howto/logging-cookbook.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1955,7 +1955,7 @@ Subclass ``QueueListener``
class NNGSocketListener(logging.handlers.QueueListener):

def __init__(self, uri, /, *handlers, **kwargs):
# Have a timeout for interruptability, and open a
# Have a timeout for interruptibility, and open a
# subscriber socket
socket = pynng.Sub0(listen=uri, recv_timeout=500)
# The b'' subscription matches all topics
Expand Down
2 changes: 2 additions & 0 deletions Doc/library/curses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1321,6 +1321,8 @@ Reading window contents
The bottom 8 bits are the character proper and the upper bits are the attributes;
extract them with the :data:`A_CHARTEXT` and :data:`A_ATTRIBUTES` bit-masks,
and the color pair with :func:`pair_number`.
The character byte is the locale-encoded byte of the cell's character,
consistent with :meth:`instr`.
It cannot represent a cell holding combining characters, a character that does
not fit in a single byte, or a color pair outside the :func:`color_pair`
range; use :meth:`in_wch` for those, which returns it as a :class:`complexchar`.
Expand Down
7 changes: 4 additions & 3 deletions Doc/library/datatypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ The modules described in this chapter provide a variety of specialized data
types such as dates and times, fixed-type arrays, heap queues, double-ended
queues, and enumerations.

Python also provides some built-in data types, in particular,
:class:`dict`, :class:`list`, :class:`set` and :class:`frozenset`, and
:class:`tuple`. The :class:`str` class is used to hold
Python also provides :ref:`some built-in data types <bltin-types>`, in particular,
:class:`list`, :class:`tuple`, :class:`dict`, :class:`frozendict`,
:class:`set`, and :class:`frozenset`.
The :class:`str` class is used to hold
Unicode strings, and the :class:`bytes` and :class:`bytearray` classes are used
to hold binary data.

Expand Down
2 changes: 2 additions & 0 deletions Doc/library/getopt.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ exception:
option ``--fo`` will match as ``--foo``, but ``--f`` will
not match uniquely, so :exc:`GetoptError` will be raised.

If *longopts* is a string it gets treated as a list of a single element.

The return value consists of two elements: the first is a list of ``(option,
value)`` pairs; the second is the list of program arguments left after the
option list was stripped (this is a trailing slice of *args*). Each
Expand Down
26 changes: 26 additions & 0 deletions Doc/using/configure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,32 @@ Libraries options

.. versionadded:: 3.10

.. option:: --with-curses=ncursesw|ncurses|curses

Designate a backend library for the :mod:`curses` and :mod:`curses.panel`
modules.

* ``ncursesw``: Use the wide-character ``libncursesw`` (and ``libpanelw``),
found via ``pkg-config``.
* ``ncurses``: Use ``libncurses`` (and ``libpanel``), found via
``pkg-config``.
* ``curses``: Use the system's native ``libcurses`` (and ``libpanel``), such
as on NetBSD or Solaris. It is built with wide-character support when the
library provides it.

Without this option (or with ``--with-curses=auto``, the default), Python
tries ``ncursesw`` and then ``ncurses``; the native ``curses`` is used only
when requested explicitly.

.. versionadded:: next

.. option:: --without-curses

Don't build the :mod:`curses` and :mod:`curses.panel` modules, even when a
curses library is present (built by default when one is found).

.. versionadded:: next

.. option:: --with-libm=STRING

Override ``libm`` math library to *STRING* (default is system-dependent).
Expand Down
20 changes: 20 additions & 0 deletions Doc/whatsnew/3.16.rst
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,17 @@ os
(Contributed by Maurycy Pawłowski-Wieroński in :gh:`149464`.)


pydoc
-----

* Modernize the HTML output of :mod:`pydoc`. The pages generated by the
:mod:`pydoc` HTTP server now use semantic HTML5 markup and a new style
sheet based on the python-docs-theme used by `docs.python.org
<https://docs.python.org/>`__, with dark mode support. Class members
inherited from other classes are collapsed by default.
(Contributed by Serhiy Storchaka in :gh:`153906`.)


re
--

Expand Down Expand Up @@ -768,6 +779,15 @@ Build changes

(Contributed by Stefano Rivera in :gh:`131372`.)

* Add the :option:`--with-curses` :program:`configure` option to select the
curses backend for the :mod:`curses` and :mod:`curses.panel` modules.
In addition to ``ncursesw`` and ``ncurses``, it can now build against the
system's native ``curses`` library (for example on NetBSD or Solaris), with
wide-character support when the library provides it. :option:`--without-curses`
excludes the modules from the build.

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


C API changes
=============
Expand Down
8 changes: 5 additions & 3 deletions Lib/ctypes/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,8 @@ def _process_struct(decorated_class, /, *, align, layout, endian, pack):
fields.extend(decorated_class._fields_)
anonymous.extend(decorated_class._anonymous_)

for name, hint in annotationlib.get_annotations(decorated_class).items():
annotations = annotationlib.get_annotations(decorated_class, eval_str=True)
for name, hint in annotations.items():
if get_origin(hint) is ClassVar:
continue

Expand All @@ -531,7 +532,8 @@ def _process_struct(decorated_class, /, *, align, layout, endian, pack):
else:
field.append(hint)

fields.append(field)
# _fields_ is a list of tuples
fields.append(tuple(field))

if endian == 'big':
endian_class = BigEndianStructure
Expand Down Expand Up @@ -579,7 +581,7 @@ def wrap_dll_function(dll):
def decorator(func):
name = func.__name__
ptr = getattr(dll, name)
annotations = annotationlib.get_annotations(func)
annotations = annotationlib.get_annotations(func, eval_str=True)

try:
restype = annotations.pop("return")
Expand Down
Loading
Loading