8000 Merge branch 'main' into gh-90385/add-pathlib-path-whatsnew-section · zmievsa/cpython@97dbe4c · GitHub
[go: up one dir, main page]

Skip to content

Commit 97dbe4c

Browse files
authored
Merge branch 'main' into pythongh-90385/add-pathlib-path-whatsnew-section
2 parents 3933501 + 5f3c9fd commit 97dbe4c

File tree

234 files changed

+4405
-2724
lines changed

Some content is hidden

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

234 files changed

+4405
-2724
lines changed

.github/CONTRIBUTING.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ Build Status
66

77
- main
88

9-
+ `Stable buildbots <http://buildbot.python.org/3.x.stable/>`_
9+
+ `Stable buildbots <https://buildbot.python.org/3.x.stable/>`_
1010

1111
- 3.9
1212

13-
+ `Stable buildbots <http://buildbot.python.org/3.9.stable/>`_
13+
+ `Stable buildbots <https://buildbot.python.org/3.9.stable/>`_
1414

1515
- 3.8
1616

17-
+ `Stable buildbots <http://buildbot.python.org/3.8.stable/>`_
17+
+ `Stable buildbots <https://buildbot.python.org/3.8.stable/>`_
1818

1919
- 3.7
2020

21-
+ `Stable buildbots <http://buildbot.python.org/3.7.stable/>`_
21+
+ `Stable buildbots <https://buildbot.python.org/3.7.stable/>`_
2222

2323

2424
Thank You

.github/workflows/doc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,4 @@ jobs:
7878
run: make -C Doc/ PYTHON=../python venv
7979
# Use "xvfb-run" since some doctest tests open GUI windows
8080
- name: 'Run documentation doctest'
81-
run: xvfb-run make -C Doc/ PYTHON=../python SPHINXOPTS="-q" SPHINXERRORHANDLING="-W --keep-going" doctest
81+
run: xvfb-run make -C Doc/ PYTHON=../python SPHINXERRORHANDLING="-W --keep-going" doctest

Doc/about.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ About these documents
66
These documents are generated from `reStructuredText`_ sources by `Sphinx`_, a
77
document processor specifically written for the Python documentation.
88

9-
.. _reStructuredText: http://docutils.sourceforge.net/rst.html
9+
.. _reStructuredText: https://docutils.sourceforge.io/rst.html
1010
.. _Sphinx: http://sphinx-doc.org/
1111

1212
.. In the online version of these documents, you can submit comments and suggest
@@ -21,7 +21,7 @@ Many thanks go to:
2121

2222
* Fred L. Drake, Jr., the creator of the original Python documentation toolset
2323
and writer of much of the content;
24-
* the `Docutils <http://docutils.sourceforge.net/>`_ project for creating
24+
* the `Docutils <https://docutils.sourceforge.io/>`_ project for creating
2525
reStructuredText and the Docutils suite;
2626
* Fredrik Lundh for his Alternative Python Reference project from which Sphinx
2727
got many good ideas.

Doc/c-api/call.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ This bears repeating:
5757
A class supporting vectorcall **must** also implement
5858
:c:member:`~PyTypeObject.tp_call` with the same semantics.
5959

60+
.. versionchanged:: 3.12
61+
62+
The :const:`Py_TPFLAGS_HAVE_VECTORCALL` flag is now removed from a class
63+
when the class's :py:meth:`~object.__call__` method is reassigned.
64+
(This internally sets :c:member:`~PyTypeObject.tp_call` only, and thus
65+
may make it behave differently than the vectorcall function.)
66+
In earlier Python versions, vectorcall should only be used with
67+
:const:`immutable <Py_TPFLAGS_IMMUTABLETYPE>` or static types.
68+
6069
A class should not implement vectorcall if that would be slower
6170
than *tp_call*. For example, if the callee needs to convert
6271
the arguments to an args tuple and kwargs dict anyway, then there is no point

Doc/c-api/code.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,28 @@ bound into a function.
9090
9191
.. versionadded:: 3.11
9292
93+
.. c:function:: PyObject* PyCode_GetVarnames(PyCodeObject *co)
94+
95+
Equivalent to the Python code ``getattr(co, 'co_varnames')``.
96+
Returns a new reference to a :c:type:`PyTupleObject` containing the names of
97+
the local variables. On error, ``NULL`` is returned and an exception
98+
is raised.
99+
100+
.. versionadded:: 3.11
101+
102+
.. c:function:: PyObject* PyCode_GetCellvars(PyCodeObject *co)
103+
104+
Equivalent to the Python code ``getattr(co, 'co_cellvars')``.
105+
Returns a new reference to a :c:type:`PyTupleObject` containing the names of
106+
the local variables that are referenced by nested functions. On error, ``NULL``
107+
is returned and an exception is raised.
108+
109+
.. versionadded:: 3.11
110+
111+
.. c:function:: PyObject* PyCode_GetFreevars(PyCodeObject *co)
112+
113+
Equivalent to the Python code ``getattr(co, 'co_freevars')``.
114+
Returns a new reference to a :c:type:`PyTupleObject` containing the names of
115+
the free variables. On error, ``NULL`` is returned and an exception is raised.
116+
117+
.. versionadded:: 3.11

Doc/c-api/typeobj.rst

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Quick Reference
135135
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
136136
| [:c:member:`~PyTypeObject.tp_cache`] | :c:type:`PyObject` * | | | | |
137137
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
138-
| [:c:member:`~PyTypeObject.tp_subclasses`] | :c:type:`PyObject` * | __subclasses__ | | | |
138+
| [:c:member:`~PyTypeObject.tp_subclasses`] | void * | __subclasses__ | | | |
139139
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
140140
| [:c:member:`~PyTypeObject.tp_weaklist`] | :c:type:`PyObject` * | | | | |
141141
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
@@ -720,29 +720,29 @@ and :c:type:`PyType_Type` effectively act as defaults.)
720720
with the *vectorcallfunc* fun 10000 ction.
721721
This can be done by setting *tp_call* to :c:func:`PyVectorcall_Call`.
722722

723-
.. warning::
724-
725-
It is not recommended for :ref:`mutable heap types <heap-types>` to implement
726-
the vectorcall protocol.
727-
When a user sets :attr:`__call__` in Python code, only *tp_call* is updated,
728-
likely making it inconsistent with the vectorcall function.
729-
730723
.. versionchanged:: 3.8
731724

732725
Before version 3.8, this slot was named ``tp_print``.
733726
In Python 2.x, it was used for printing to a file.
734727
In Python 3.0 to 3.7, it was unused.
735728

729+
.. versionchanged:: 3.12
730+
731+
Before version 3.12, it was not recommended for
732+
:ref:`mutable heap types <heap-types>` to implement the vectorcall
733+
protocol.
734+
When a user sets :attr:`~type.__call__` in Python code, only *tp_call* is
735+
updated, likely making it inconsistent with the vectorcall function.
736+
Since 3.12, setting ``__call__`` will disable vectorcall optimization
737+
by clearing the :const:`Py_TPFLAGS_HAVE_VECTORCALL` flag.
738+
736739
**Inheritance:**
737740

738741
This field is always inherited.
739742
However, the :const:`Py_TPFLAGS_HAVE_VECTORCALL` flag is not
740-
always inherited. If it's not, then the subclass won't use
743+
always inherited. If it's not set, then the subclass won't use
741744
:ref:`vectorcall <vectorcall>`, except when
742745
:c:func:`PyVectorcall_Call` is explicitly called.
743-
This is in particular the case for types without the
744-
:const:`Py_TPFLAGS_IMMUTABLETYPE` flag set (including subclasses defined in
745-
Python).
746746

747747

748748
.. c:member:: getattrfunc PyTypeObject.tp_getattr
@@ -1178,12 +1178,18 @@ and :c:type:`PyType_Type` effectively act as defaults.)
11781178

11791179
**Inheritance:**
11801180

1181-
This bit is inherited for types with the
1182-
:const:`Py_TPFLAGS_IMMUTABLETYPE` flag set, if
1183-
:c:member:`~PyTypeObject.tp_call` is also inherited.
1181+
This bit is inherited if :c:member:`~PyTypeObject.tp_call` is also
1182+
inherited.
11841183

11851184
.. versionadded:: 3.9
11861185

1186+
.. versionchanged:: 3.12
1187+
1188+
This flag is now removed from a class when the class's
1189+
:py:meth:`~object.__call__` method is reassigned.
1190+
1191+
This flag can now be inherited by mutable classes.
1192+
11871193
.. data:: Py_TPFLAGS_IMMUTABLETYPE
11881194

11891195
This bit is set for type objects that are immutable: type attributes cannot be set nor deleted.
@@ -1928,9 +1934,17 @@ and :c:type:`PyType_Type` effectively act as defaults.)
19281934
This field is not inherited.
19291935

19301936

1931-
.. c:member:: PyObject* PyTypeObject.tp_subclasses
1937+
.. c:member:: void* PyTypeObject.tp_subclasses
1938+
1939+
A collection of subclasses. Internal use only. May be an invalid pointer.
1940+
1941+
To get a list of subclasses, call the Python method
1942+
:py:meth:`~class.__subclasses__`.
1943+
1944+
.. versionchanged:: 3.12
19321945

1933-
List of weak references to subclasses. Internal use only.
1946+
For some types, this field does not hold a valid :c:expr:`PyObject*`.
1947+
The type was changed to :c:expr:`void*` to indicate this.
19341948

19351949
**Inheritance:**
19361950

Doc/conf.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
import _tkinter
2323
except ImportError:
2424
_tkinter = None
25+
# Treat warnings as errors, done here to prevent warnings in Sphinx code from
26+
# causing spurious test failures.
27+
import warnings
28+
warnings.simplefilter('error')
29+
del warnings
2530
'''
2631

2732
manpages_url = 'https://manpages.debian.org/{path}'
@@ -74,6 +79,13 @@
7479
'root_include_title': False # We use the version switcher instead.
7580
}
7681

82+
# Override stylesheet fingerprinting for Windows CHM htmlhelp to fix GH-91207
83+
# https://github.com/python/cpython/issues/91207
84+
if any('htmlhelp' in arg for arg in sys.argv):
85+
html_style = 'pydoctheme.css'
86+
print("\nWARNING: Windows CHM Help is no longer supported.")
87+
print("It may be removed in the future\n")
88+
7789
# Short title used e.g. for <title> HTML tags.
7890
html_short_title = '%s Documentation' % release
7991

Doc/extending/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ Recommended third party tools
2727

2828
This guide only covers the basic tools for creating extensions provided
2929
as part of this version of CPython. Third party tools like
30-
`Cython <http://cython.org/>`_, `cffi <https://cffi.readthedocs.io>`_,
31-
`SWIG <http://www.swig.org>`_ and `Numba <https://numba.pydata.org/>`_
30+
`Cython <https://cython.org/>`_, `cffi <https://cffi.readthedocs.io>`_,
31+
`SWIG <https://www.swig.org>`_ and `Numba <https://numba.pydata.org/>`_
3232
offer both simpler and more sophisticated approaches to creating C and C++
3333
extensions for Python.
3434

Doc/faq/design.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,8 @@ is exactly the same type of object that a lambda expression yields) is assigned!
321321
Can Python be compiled to machine code, C or some other language?
322322
-----------------------------------------------------------------
323323

324-
`Cython <http://cython.org/>`_ compiles a modified version of Python with
325-
optional annotations into C extensions. `Nuitka <http://www.nuitka.net/>`_ is
324+
`Cython <https://cython.org/>`_ compiles a modified version of Python with
325+
optional annotations into C extensions. `Nuitka <https://www.nuitka.net/>`_ is
326326
an up-and-coming compiler of Python into C++ code, aiming to support the full
327327
Python language.
328328

@@ -338,8 +338,8 @@ cycles and deletes the objects involved. The :mod:`gc` module provides functions
338338
to perform a garbage collection, obtain debugging statistics, and tune the
339339
collector's parameters.
340340

341-
Other implementations (such as `Jython <http://www.jython.org>`_ or
342-
`PyPy <http://www.pypy.org>`_), however, can rely on a different mechanism
341+
Other implementations (such as `Jython <https://www.jython.org>`_ or
342+
`PyPy <https://www.pypy.org>`_), however, can rely on a different mechanism
343343
such as a full-blown garbage collector. This difference can cause some
344344
subtle porting problems if your Python code depends on the behavior of the
345345
reference counting implementation.

Doc/faq/extending.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,18 @@ on what you're trying to do.
4141

4242
.. XXX make sure these all work
4343
44-
`Cython <http://cython.org>`_ and its relative `Pyrex
44+
`Cython <https://cython.org>`_ and its relative `Pyrex
4545
<https://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/>`_ are compilers
4646
that accept a slightly modified form of Python and generate the corresponding
4747
C code. Cython and Pyrex make it possible to write an extension without having
4848
to learn Python's C API.
4949

5050
If you need to interface to some C or C++ library for which no Python extension
5151
currently exists, you can try wrapping the library's data types and functions
52-
with a tool such as `SWIG <http://www.swig.org>`_. `SIP
52+
with a tool such as `SWIG <https://www.swig.org>`_. `SIP
5353
<https://riverbankcomputing.com/software/sip/intro>`__, `CXX
5454
<http://cxx.sourceforge.net/>`_ `Boost
55-
<http://www.boost.org/libs/python/doc/index.html>`_, or `Weave
55+
<https://www.boost.org/libs/python/doc/index.html>`_, or `Weave
56 6DD9 56
<https://github.com/scipy/weave>`_ are also
5757
alternatives for wrapping C++ libraries.
5858

@@ -286,6 +286,6 @@ Can I create an object class with some methods implemented in C and others in Py
286286
Yes, you can inherit from built-in classes such as :class:`int`, :class:`list`,
287287
:class:`dict`, etc.
288288

289-
The Boost Python Library (BPL, http://www.boost.org/libs/python/doc/index.html)
289+
The Boost Python Library (BPL, https://www.boost.org/libs/python/doc/index.html)
290290
provides a way of doing this from C++ (i.e. you can inherit from an extension
291291
class written in C++ using the BPL).

0 commit comments

Comments
 (0)
0