Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
4b66b6b
gh-120104: IDLE: Fix padding in config and search dialogs (#120107)
serhiy-storchaka Aug 6, 2024
58be1c2
gh-112301: Add macOS warning tracking tooling (#122211)
nohlson Aug 6, 2024
c4e8196
Fix duplicated words 'begins with a' in pathlib docstring (#122732)
vitaldmit Aug 6, 2024
1429651
gh-121103: Update site module docs for free-threaded installs (#122737)
colesbury Aug 6, 2024
dc09301
gh-122417: Implement per-thread heap type refcounts (#122418)
colesbury Aug 6, 2024
5b8a6c5
gh-122744: Bump bundled pip to 24.2 (#122745)
pradyunsg Aug 6, 2024
4767a6e
gh-122728: Fix SystemError in PyEval_GetLocals() (#122735)
vstinner Aug 6, 2024
b5e142b
gh-122571: Remove duplicate definition of PY_BUILTIN_HASHLIB_HASHES i…
msprotz Aug 6, 2024
98dba73
GH-73991: Rework `pathlib.Path.rmtree()` into `delete()` (#122368)
barneygale Aug 7, 2024
b6c80e2
Fix typos in comments and docstring (#122720)
xyb Aug 7, 2024
9e551f9
gh-79846: Make ssl.create_default_context() ignore invalid certificat…
pukkandan Aug 7, 2024
013a092
gh-121151: argparse: Fix wrapping of long usage text of arguments ins…
hamdanal Aug 7, 2024
674a50e
gh-117139: Fix an incorrect borrow in bytecodes.c (#122318)
colesbury Aug 7, 2024
76bdeeb
gh-122511: Improve documentation for object identity of mutable/immut…
picnixz Aug 7, 2024
61a8bf2
gh-122759: Remove `assert` from `RERAISE` error handling (#122760)
sobolevn Aug 7, 2024
c25898d
Doc: cmdline.rst: Include -P and -R in usage (#122590)
wimglenn Aug 7, 2024
0bd9375
gh-100256: Skip inaccessible registry keys in the WinAPI mimetype imp…
LucasEsposito Aug 7, 2024
19dd2dc
Bump types-setuptools to 71.1.0.20240726 in /Tools (#122551)
dependabot[bot] Aug 7, 2024
967a4f1
Docs: Change `remove` to `removes` for consistency (#121072)
smij720 Aug 7, 2024
3e753c6
gh-118926: Spill deferred references to stack in cases generator (#12…
colesbury Aug 7, 2024
d2e5be1
gh-122798: Make tests for warnings in the re module more strict (GH-1…
serhiy-storchaka Aug 7, 2024
f9637b4
Remove dead code in the RE parser (GH-122796)
serhiy-storchaka Aug 7, 2024
42d9bec
gh-118761: Improve import time of `pprint` (#122725)
hugovk Aug 7, 2024
e73e7a7
gh-122478: Remove internal frames from tracebacks in REPL (GH-122528)
serhiy-storchaka Aug 7, 2024
540fcc6
gh-118814: Fix the TypeVar constructor when name is passed by keyword…
serhiy-storchaka Aug 7, 2024
e006c73
gh-105201: Add PyIter_NextItem() (#122331)
erlend-aasland Aug 7, 2024
57d7c3e
gh-122247: Move instruction instrumentation sanity check after tracin…
gaogaotiantian Aug 8, 2024
3f76b6b
gh-120782: Update datetime test for static type immutability (#122800)
neonene Aug 8, 2024
6094c6f
gh-116263: Do not rollover empty files in RotatingFileHandler (GH-122…
serhiy-storchaka Aug 8, 2024
fe13c9b
gh-122255: Add black box tests in test_warnings (GH-122227)
serhiy-storchaka Aug 8, 2024
acf0d9e
InternalDocs: Fix typo in link to instruction_sequence.c inside compi…
JuanFKurucz Aug 8, 2024
0d9c123
gh-122744: test_venv: ignore pip's complaint about missing ssl (GH-12…
encukou Aug 8, 2024
81c739e
GH-120024: Tidy up case generator code a bit. (GH-122780)
markshannon Aug 8, 2024
bf8b374
gh-111495: Add more tests on PyEval C APIs (#122789)
vstinner Aug 8, 2024
833eb10
gh-122562: fix dump_symtable for ste_free and ste_child_free removal …
iritkatriel Aug 8, 2024
2d9d3a9
gh-122697: Fix free-threading memory leaks at shutdown (#122703)
colesbury Aug 8, 2024
2037d8c
gh-122835: Fix module name in ``test_typing`` (#122836)
Eclips4 Aug 8, 2024
aab18f4
gh-112301: Update documentation for configure options (``--disable-sa…
nohlson Aug 8, 2024
8c9d174
GH-118943: Remove regen-jit from the regen-all make target (GH-122602)
hroncok Aug 8, 2024
2f5c3b0
gh-116622: Rename build variable MODULE_LDFLAGS back to LIBPYTHON (#1…
mhsmith Aug 8, 2024
b6e745a
gh-121268: Remove workarounds for non-IEEE 754 systems in cmath (#122…
skirpichev Aug 9, 2024
8393608
gh-122688: Fix support of var-positional parameter in Argument Clinic…
serhiy-storchaka Aug 9, 2024
b4a3160
gh-111495: Fix refleaks in test_capi.test_eval tests (#122851)
vstinner Aug 9, 2024
d323997
gh-105376: Restore deprecated logging warn() method (#122775)
vstinner Aug 9, 2024
0fd97e4
gh-122868: Add lower bounds for sphinxcontrib dependencies (#122870)
AA-Turner Aug 9, 2024
ed9319c
Attempt to speed up ready
bdraco Aug 10, 2024
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
4 changes: 3 additions & 1 deletion .github/workflows/reusable-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ jobs:
--prefix=/opt/python-dev \
--with-openssl="$(brew --prefix [email protected])"
- name: Build CPython
run: make -j8
run: set -o pipefail; make -j8 2>&1 | tee compiler_output.txt
- name: Display build info
run: make pythoninfo
- name: Check compiler warnings
run: python3 Tools/build/check_warnings.py --compiler-output-file-path=compiler_output.txt --warning-ignore-file-path=Tools/build/.warningignore_macos --compiler-output-type=clang
- name: Tests
run: make test
2 changes: 1 addition & 1 deletion .github/workflows/reusable-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
working-directory: ${{ env.CPYTHON_BUILDDIR }}
run: make pythoninfo
- name: Check compiler warnings
run: python Tools/build/check_warnings.py --compiler-output-file-path=${{ env.CPYTHON_BUILDDIR }}/compiler_output.txt --warning-ignore-file-path ${GITHUB_WORKSPACE}/Tools/build/.warningignore_ubuntu
run: python Tools/build/check_warnings.py --compiler-output-file-path=${{ env.CPYTHON_BUILDDIR }}/compiler_output.txt --warning-ignore-file-path ${GITHUB_WORKSPACE}/Tools/build/.warningignore_ubuntu --compiler-output-type=json
- name: Remount sources writable for tests
# some tests write to srcdir, lack of pyc files slows down testing
run: sudo mount $CPYTHON_RO_SRCDIR -oremount,rw
Expand Down
43 changes: 15 additions & 28 deletions Doc/c-api/iter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ There are two functions specifically for working with iterators.
.. c:function:: int PyIter_Check(PyObject *o)

Return non-zero if the object *o* can be safely passed to
:c:func:`PyIter_Next`, and ``0`` otherwise. This function always succeeds.
:c:func:`PyIter_NextItem` and ``0`` otherwise.
This function always succeeds.

.. c:function:: int PyAIter_Check(PyObject *o)

Expand All @@ -19,41 +20,27 @@ There are two functions specifically for working with iterators.

.. versionadded:: 3.10

.. c:function:: int PyIter_NextItem(PyObject *iter, PyObject **item)

Return ``1`` and set *item* to a :term:`strong reference` of the
next value of the iterator *iter* on success.
Return ``0`` and set *item* to ``NULL`` if there are no remaining values.
Return ``-1``, set *item* to ``NULL`` and set an exception on error.

.. versionadded:: 3.14

.. c:function:: PyObject* PyIter_Next(PyObject *o)

This is an older version of :c:func:`!PyIter_NextItem`,
which is retained for backwards compatibility.
Prefer :c:func:`PyIter_NextItem`.

Return the next value from the iterator *o*. The object must be an iterator
according to :c:func:`PyIter_Check` (it is up to the caller to check this).
If there are no remaining values, returns ``NULL`` with no exception set.
If an error occurs while retrieving the item, returns ``NULL`` and passes
along the exception.

To write a loop which iterates over an iterator, the C code should look
something like this::

PyObject *iterator = PyObject_GetIter(obj);
PyObject *item;

if (iterator == NULL) {
/* propagate error */
}

while ((item = PyIter_Next(iterator))) {
/* do something with item */
...
/* release reference when done */
Py_DECREF(item);
}

Py_DECREF(iterator);

if (PyErr_Occurred()) {
/* propagate error */
}
else {
/* continue doing useful work */
}


.. c:type:: PySendResult

The enum value used to represent different results of :c:func:`PyIter_Send`.
Expand Down
6 changes: 3 additions & 3 deletions Doc/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ packaging<25
Pygments<3
requests<3
snowballstemmer<3
sphinxcontrib-applehelp<2.1
sphinxcontrib-devhelp<2.1
sphinxcontrib-applehelp>=1.0.6,<2.1
sphinxcontrib-devhelp>=1.0.6,<2.1
sphinxcontrib-htmlhelp<2.2
sphinxcontrib-jsmath<1.1
sphinxcontrib-qthelp<2.1
sphinxcontrib-qthelp>=1.0.6,<2.1
sphinxcontrib-serializinghtml<2.1

# Direct dependencies of Jinja2 (Jinja is a dependency of Sphinx, see above)
Expand Down
4 changes: 4 additions & 0 deletions Doc/data/refcounts.dat
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,10 @@ PyAIter_Check:PyObject*:o:0:
PyIter_Next:PyObject*::+1:
PyIter_Next:PyObject*:o:0:

PyIter_NextItem:int:::
PyIter_NextItem:PyObject*:iter:0:
PyIter_NextItem:PyObject**:item:+1:

PyIter_Send:int:::
PyIter_Send:PyObject*:iter:0:
PyIter_Send:PyObject*:arg:0:
Expand Down
1 change: 1 addition & 0 deletions Doc/data/stable_abi.dat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Doc/deprecations/pending-removal-in-future.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ although there is currently no date scheduled for their removal.
* ``EntryPoints`` tuple interface.
* Implicit ``None`` on return values.

* :mod:`logging`: the ``warn()`` method has been deprecated
since Python 3.3, use :meth:`~logging.warning()` instead.

* :mod:`mailbox`: Use of StringIO input and text mode is deprecated, use
BytesIO and binary mode instead.

Expand Down
17 changes: 4 additions & 13 deletions Doc/library/logging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,6 @@ in a module, ``__name__`` is the module's name in the Python package namespace.
.. versionchanged:: 3.8
The *stacklevel* parameter was added.

.. versionchanged:: 3.13
Remove the undocumented ``warn()`` method which was an alias to the
:meth:`warning` method.


.. method:: Logger.info(msg, *args, **kwargs)

Expand All @@ -368,6 +364,10 @@ in a module, ``__name__`` is the module's name in the Python package namespace.
Logs a message with level :const:`WARNING` on this logger. The arguments are
interpreted as for :meth:`debug`.

.. note:: There is an obsolete method ``warn`` which is functionally
identical to ``warning``. As ``warn`` is deprecated, please do not use
it - use ``warning`` instead.

.. method:: Logger.error(msg, *args, **kwargs)

Logs a message with level :const:`ERROR` on this logger. The arguments are
Expand Down Expand Up @@ -1124,11 +1124,6 @@ information into logging calls. For a usage example, see the section on
Attribute :attr:`!manager` and method :meth:`!_log` were added, which
delegate to the underlying logger and allow adapters to be nested.

.. versionchanged:: 3.13

Remove the undocumented :meth:`!warn`` method which was an alias to the
:meth:`!warning` method.

.. versionchanged:: 3.13

The *merge_extra* argument was added.
Expand Down Expand Up @@ -1224,10 +1219,6 @@ functions.
identical to ``warning``. As ``warn`` is deprecated, please do not use
it - use ``warning`` instead.

.. versionchanged:: 3.13
Remove the undocumented ``warn()`` function which was an alias to the
:func:`warning` function.


.. function:: error(msg, *args, **kwargs)

Expand Down
49 changes: 28 additions & 21 deletions Doc/library/pathlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1636,7 +1636,7 @@ Copying, renaming and deleting
.. method:: Path.unlink(missing_ok=False)

Remove this file or symbolic link. If the path points to a directory,
use :func:`Path.rmdir` instead.
use :func:`Path.rmdir` or :func:`Path.delete` instead.

If *missing_ok* is false (the default), :exc:`FileNotFoundError` is
raised if the path does not exist.
Expand All @@ -1650,33 +1650,40 @@ Copying, renaming and deleting

.. method:: Path.rmdir()

Remove this directory. The directory must be empty.
Remove this directory. The directory must be empty; use
:meth:`Path.delete` to remove a non-empty directory.


.. method:: Path.rmtree(ignore_errors=False, on_error=None)
.. method:: Path.delete(ignore_errors=False, on_error=None)

Recursively delete this entire directory tree. The path must not refer to a symlink.
Delete this file or directory. If this path refers to a non-empty
directory, its files and sub-directories are deleted recursively.

If *ignore_errors* is true, errors resulting from failed removals will be
ignored. If *ignore_errors* is false or omitted, and a function is given to
*on_error*, it will be called each time an exception is raised. If neither
*ignore_errors* nor *on_error* are supplied, exceptions are propagated to
the caller.
If *ignore_errors* is true, errors resulting from failed deletions will be
ignored. If *ignore_errors* is false or omitted, and a callable is given as
the optional *on_error* argument, it will be called with one argument of
type :exc:`OSError` each time an exception is raised. The callable can
handle the error to continue the deletion process or re-raise it to stop.
Note that the filename is available as the :attr:`~OSError.filename`
attribute of the exception object. If neither *ignore_errors* nor
*on_error* are supplied, exceptions are propagated to the caller.

.. note::

On platforms that support the necessary fd-based functions, a symlink
attack-resistant version of :meth:`~Path.rmtree` is used by default. On
other platforms, the :func:`~Path.rmtree` implementation is susceptible
to a symlink attack: given proper timing and circumstances, attackers
can manipulate symlinks on the filesystem to delete files they would not
be able to access otherwise.

If the optional argument *on_error* is specified, it should be a callable;
it will be called with one argument of type :exc:`OSError`. The
callable can handle the error to continue the deletion process or re-raise
it to stop. Note that the filename is available as the :attr:`~OSError.filename`
attribute of the exception object.
When deleting non-empty directories on platforms that lack the necessary
file descriptor-based functions, the :meth:`~Path.delete` implementation
is susceptible to a symlink attack: given proper timing and
circumstances, attackers can manipulate symlinks on the filesystem to
delete files they would not be able to access otherwise. Applications
can use the :data:`~Path.delete.avoids_symlink_attacks` method attribute
to determine whether the implementation is immune to this attack.

.. attribute:: delete.avoids_symlink_attacks

Indicates whether the current platform and implementation provides a
symlink attack resistant version of :meth:`~Path.delete`. Currently
this is only true for platforms supporting fd-based directory access
functions.

.. versionadded:: 3.14

Expand Down
17 changes: 13 additions & 4 deletions Doc/library/site.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,22 @@ It starts by constructing up to four directories from a head and a tail part.
For the head part, it uses ``sys.prefix`` and ``sys.exec_prefix``; empty heads
are skipped. For the tail part, it uses the empty string and then
:file:`lib/site-packages` (on Windows) or
:file:`lib/python{X.Y}/site-packages` (on Unix and macOS). For each
:file:`lib/python{X.Y[t]}/site-packages` (on Unix and macOS). (The
optional suffix "t" indicates the :term:`free threading` build, and is
appended if ``"t"`` is present in the :attr:`sys.abiflags` constant.)
For each
of the distinct head-tail combinations, it sees if it refers to an existing
directory, and if so, adds it to ``sys.path`` and also inspects the newly
added path for configuration files.

.. versionchanged:: 3.5
Support for the "site-python" directory has been removed.

.. versionchanged:: 3.13
On Unix, :term:`Free threading <free threading>` Python installations are
identified by the "t" suffix in the version-specific directory name, such as
:file:`lib/python3.13t/`.

If a file named "pyvenv.cfg" exists one directory above sys.executable,
sys.prefix and sys.exec_prefix are set to that directory and
it is also checked for site-packages (sys.base_prefix and
Expand Down Expand Up @@ -188,11 +196,12 @@ Module contents

Path to the user site-packages for the running Python. Can be ``None`` if
:func:`getusersitepackages` hasn't been called yet. Default value is
:file:`~/.local/lib/python{X.Y}/site-packages` for UNIX and non-framework
:file:`~/.local/lib/python{X.Y}[t]/site-packages` for UNIX and non-framework
macOS builds, :file:`~/Library/Python/{X.Y}/lib/python/site-packages` for macOS
framework builds, and :file:`{%APPDATA%}\\Python\\Python{XY}\\site-packages`
on Windows. This directory is a site directory, which means that
:file:`.pth` files in it will be processed.
on Windows. The optional "t" indicates the free-threaded build. This
directory is a site directory, which means that :file:`.pth` files in it
will be processed.


.. data:: USER_BASE
Expand Down
5 changes: 3 additions & 2 deletions Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1245,8 +1245,9 @@ accepts integers that meet the value restriction ``0 <= x <= 255``).
| ``s.pop()`` or ``s.pop(i)`` | retrieves the item at *i* and | \(2) |
| | also removes it from *s* | |
+------------------------------+--------------------------------+---------------------+
| ``s.remove(x)`` | remove the first item from *s* | \(3) |
| | where ``s[i]`` is equal to *x* | |
| ``s.remove(x)`` | removes the first item from | \(3) |
| | *s* where ``s[i]`` is equal to | |
| | *x* | |
+------------------------------+--------------------------------+---------------------+
| ``s.reverse()`` | reverses the items of *s* in | \(4) |
| | place | |
Expand Down
16 changes: 10 additions & 6 deletions Doc/reference/datamodel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,16 @@ that mutable object is changed.
Types affect almost all aspects of object behavior. Even the importance of
object identity is affected in some sense: for immutable types, operations that
compute new values may actually return a reference to any existing object with
the same type and value, while for mutable objects this is not allowed. E.g.,
after ``a = 1; b = 1``, ``a`` and ``b`` may or may not refer to the same object
with the value one, depending on the implementation, but after ``c = []; d =
[]``, ``c`` and ``d`` are guaranteed to refer to two different, unique, newly
created empty lists. (Note that ``c = d = []`` assigns the same object to both
``c`` and ``d``.)
the same type and value, while for mutable objects this is not allowed.
For example, after ``a = 1; b = 1``, *a* and *b* may or may not refer to
the same object with the value one, depending on the implementation.
This is because :class:`int` is an immutable type, so the reference to ``1``
can be reused. This behaviour depends on the implementation used, so should
not be relied upon, but is something to be aware of when making use of object
identity tests.
However, after ``c = []; d = []``, *c* and *d* are guaranteed to refer to two
different, unique, newly created empty lists. (Note that ``e = f = []`` assigns
the *same* object to both *e* and *f*.)


.. _types:
Expand Down
2 changes: 1 addition & 1 deletion Doc/using/cmdline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Command line

When invoking Python, you may specify any of these options::

python [-bBdEhiIOqsSuvVWx?] [-c command | -m module-name | script | - ] [args]
python [-bBdEhiIOPqRsSuvVWx?] [-c command | -m module-name | script | - ] [args]

The most common use case is, of course, a simple invocation of a script::

Expand Down
21 changes: 17 additions & 4 deletions Doc/using/configure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -909,19 +909,32 @@ Security Options

.. option:: --disable-safety

Disable compiler options that are recommended by `OpenSSF`_ for security reasons with no performance overhead.
Disable compiler options that are `recommended by OpenSSF`_ for security reasons with no performance overhead.
If this option is not enabled, CPython will be built based on safety compiler options with no slow down.
When this option is enabled, CPython will not be built with the compiler options listed below.

.. _OpenSSF: https://openssf.org/
The following compiler options are disabled with :option:`!--disable-safety`:

* `-fstack-protector-strong`_: Enable run-time checks for stack-based buffer overflows.
* `-Wtrampolines`_: Enable warnings about trampolines that require executable stacks.

.. _recommended by OpenSSF: https://github.com/ossf/wg-best-practices-os-developers/blob/main/docs/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.md
.. _-fstack-protector-strong: https://github.com/ossf/wg-best-practices-os-developers/blob/main/docs/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.md#enable-run-time-checks-for-stack-based-buffer-overflows
.. _-Wtrampolines: https://github.com/ossf/wg-best-practices-os-developers/blob/main/docs/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.md#enable-warning-about-trampolines-that-require-executable-stacks

.. versionadded:: 3.14

.. option:: --enable-slower-safety

Enable compiler options that are recommended by `OpenSSF`_ for security reasons which require overhead.
Enable compiler options that are `recommended by OpenSSF`_ for security reasons which require overhead.
If this option is not enabled, CPython will not be built based on safety compiler options which performance impact.
When this option is enabled, CPython will be built with the compiler options listed below.

The following compiler options are enabled with :option:`!--enable-slower-safety`:

* `-D_FORTIFY_SOURCE=3`_: Fortify sources with compile- and run-time checks for unsafe libc usage and buffer overflows.

.. _OpenSSF: https://openssf.org/
.. _-D_FORTIFY_SOURCE=3: https://github.com/ossf/wg-best-practices-os-developers/blob/main/docs/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.md#fortify-sources-for-unsafe-libc-usage-and-buffer-overflows

.. versionadded:: 3.14

Expand Down
10 changes: 0 additions & 10 deletions Doc/whatsnew/3.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1397,16 +1397,6 @@ locale
use ``locale.setlocale(locale.LC_ALL, "")`` instead.
(Contributed by Victor Stinner in :gh:`104783`.)

logging
-------

* :mod:`logging`: Remove undocumented and untested ``Logger.warn()`` and
``LoggerAdapter.warn()`` methods and ``logging.warn()`` function. Deprecated
since Python 3.3, they were aliases to the :meth:`logging.Logger.warning`
method, :meth:`!logging.LoggerAdapter.warning` method and
:func:`logging.warning` function.
(Contributed by Victor Stinner in :gh:`105376`.)

pathlib
-------

Expand Down
Loading