Skip to content

Commit 50c4809

Browse files
authored
Merge branch 'main' into namespaces
2 parents b14396e + 2fe44f7 commit 50c4809

File tree

119 files changed

+1307
-2956
lines changed

Some content is hidden

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

119 files changed

+1307
-2956
lines changed

.azure-pipelines/posix-steps.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ steps:
6868
- ${{ if eq(parameters.patchcheck, 'true') }}:
6969
- script: |
7070
git fetch origin
71-
./python Tools/scripts/patchcheck.py --ci true
71+
./python Tools/patchcheck/patchcheck.py --ci true
7272
displayName: 'Run patchcheck.py'
7373
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
7474

.github/CODEOWNERS

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
# It uses the same pattern rule for gitignore file
55
# https://git-scm.com/docs/gitignore#_pattern_format
66

7+
# GitHub
8+
.github/** @ezio-melotti
9+
710
# asyncio
811
**/*asyncio* @1st1 @asvetlov @gvanrossum
912

.github/CONTRIBUTING.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ also suggestions on how you can most effectively help the project.
3838

3939
Please be aware that our workflow does deviate slightly from the typical GitHub
4040
project. Details on how to properly submit a pull request are covered in
41-
`Lifecycle of a Pull Request <https://devguide.python.org/pullrequest/>`_.
41+
`Lifecycle of a Pull Request <https://devguide.python.org/getting-started/pull-request-lifecycle.html>`_.
4242
We utilize various bots and status checks to help with this, so do follow the
4343
comments they leave and their "Details" links, respectively. The key points of
4444
our workflow that are not covered by a bot or status check are:

.github/workflows/build.yml

+8-4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ on:
2525
permissions:
2626
contents: read
2727

28+
concurrency:
29+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
30+
cancel-in-progress: true
31+
2832
jobs:
2933
check_source:
3034
name: 'Check for source changes'
@@ -69,7 +73,7 @@ jobs:
6973
- name: Add ccache to PATH
7074
run: echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
7175
- name: Configure ccache action
72-
uses: hendrikmuhs/ccache-action@v1
76+
uses: hendrikmuhs/ccache-action@v1.2
7377
- name: Check Autoconf version 2.69 and aclocal 1.16.3
7478
run: |
7579
grep "Generated by GNU Autoconf 2.69" configure
@@ -198,7 +202,7 @@ jobs:
198202
run: |
199203
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
200204
- name: Configure ccache action
201-
uses: hendrikmuhs/ccache-action@v1
205+
uses: hendrikmuhs/ccache-action@v1.2
202206
- name: Setup directory envs for out-of-tree builds
203207
run: |
204208
echo "CPYTHON_RO_SRCDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-ro-srcdir)" >> $GITHUB_ENV
@@ -261,7 +265,7 @@ jobs:
261265
run: |
262266
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
263267
- name: Configure ccache action
264-
uses: hendrikmuhs/ccache-action@v1
268+
uses: hendrikmuhs/ccache-action@v1.2
265269
- name: Configure CPython
266270
run: ./configure --with-pydebug --with-openssl=$OPENSSL_DIR
267271
- name: Build CPython
@@ -305,7 +309,7 @@ jobs:
305309
run: |
306310
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
307311
- name: Configure ccache action
308-
uses: hendrikmuhs/ccache-action@v1
312+
uses: hendrikmuhs/ccache-action@v1.2
309313
- name: Configure CPython
310314
run: ./configure --with-address-sanitizer --without-pymalloc
311315
- name: Build CPython

.github/workflows/build_msi.yml

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ on:
1818
permissions:
1919
contents: read
2020

21+
concurrency:
22+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
23+
cancel-in-progress: true
24+
2125
jobs:
2226
build:
2327
name: Windows Installer

.github/workflows/doc.yml

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ on:
2828
permissions:
2929
contents: read
3030

31+
concurrency:
32+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
33+
cancel-in-progress: true
34+
3135
jobs:
3236
build_doc:
3337
name: 'Docs'

.github/workflows/project-updater.yml

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
- opened
77
- labeled
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
add-to-project:
1114
name: Add issues to projects

.github/workflows/verify-ensurepip-wheels.yml

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ on:
1616
permissions:
1717
contents: read
1818

19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
21+
cancel-in-progress: true
22+
1923
jobs:
2024
verify:
2125
runs-on: ubuntu-latest

Doc/Makefile

+3-16
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ PAPEROPT_letter = -D latex_elements.papersize=letterpaper
2121
ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees $(PAPEROPT_$(PAPER)) -j auto \
2222
$(SPHINXOPTS) $(SPHINXERRORHANDLING) . build/$(BUILDER) $(SOURCES)
2323

24-
.PHONY: help build html htmlhelp latex text texinfo changes linkcheck \
25-
suspicious coverage doctest pydoc-topics htmlview clean dist check serve \
26-
autobuild-dev autobuild-stable venv
24+
.PHONY: help build html htmlhelp latex text texinfo epub changes linkcheck \
25+
coverage doctest pydoc-topics htmlview clean clean-venv venv dist check serve \
26+
autobuild-dev autobuild-dev-html autobuild-stable autobuild-stable-html
2727

2828
help:
2929
@echo "Please use \`make <target>' where <target> is one of"
@@ -42,7 +42,6 @@ help:
4242
@echo " doctest to run doctests in the documentation"
4343
@echo " pydoc-topics to regenerate the pydoc topics file"
4444
@echo " dist to create a \"dist\" directory with archived docs for download"
45-
@echo " suspicious to check for suspicious markup in output text"
4645
@echo " check to run a check for frequent markup errors"
4746

4847
build:
@@ -110,18 +109,6 @@ linkcheck:
110109
"or in build/$(BUILDER)/output.txt"; \
111110
false; }
112111

113-
suspicious: BUILDER = suspicious
114-
suspicious:
115-
@$(MAKE) build BUILDER=$(BUILDER) || { \
116-
echo "Suspicious check complete; look for any errors in the above output" \
117-
"or in build/$(BUILDER)/suspicious.csv. If all issues are false" \
118-
"positives, append that file to tools/susp-ignored.csv."; \
119-
false; }
120-
@echo "⚠ make suspicious is deprecated and will be removed soon."
121-
@echo "⚠ Use:"
122-
@echo "⚠ make check"
123-
@echo "⚠ instead."
124-
125112
coverage: BUILDER = coverage
126113
coverage: build
127114
@echo "Coverage finished; see c.txt and python.txt in build/coverage"

Doc/README.rst

-3
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ Available make targets are:
9393
plain text documentation for the labels defined in
9494
``tools/pyspecific.py`` -- pydoc needs these to show topic and keyword help.
9595

96-
* "suspicious", which checks the parsed markup for text that looks like
97-
malformed and thus unconverted reST.
98-
9996
* "check", which checks for frequent markup errors.
10097

10198
* "serve", which serves the build/html directory on port 8000.

Doc/c-api/buffer.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ a buffer, see :c:func:`PyObject_GetBuffer`.
9999
For :term:`contiguous` arrays, the value points to the beginning of
100100
the memory block.
101101

102-
.. c:member:: void *obj
102+
.. c:member:: PyObject *obj
103103
104104
A new reference to the exporting object. The reference is owned by
105105
the consumer and automatically decremented and set to ``NULL`` by

Doc/c-api/dict.rst

+20-1
Original file line numberDiff line numberDiff line change
@@ -246,24 +246,41 @@ Dictionary Objects
246246
of error (e.g. no more watcher IDs available), return ``-1`` and set an
247247
exception.
248248
249+
.. versionadded:: 3.12
250+
249251
.. c:function:: int PyDict_ClearWatcher(int watcher_id)
250252
251253
Clear watcher identified by *watcher_id* previously returned from
252254
:c:func:`PyDict_AddWatcher`. Return ``0`` on success, ``-1`` on error (e.g.
253255
if the given *watcher_id* was never registered.)
254256
257+
.. versionadded:: 3.12
258+
255259
.. c:function:: int PyDict_Watch(int watcher_id, PyObject *dict)
256260
257261
Mark dictionary *dict* as watched. The callback granted *watcher_id* by
258262
:c:func:`PyDict_AddWatcher` will be called when *dict* is modified or
259-
deallocated.
263+
deallocated. Return ``0`` on success or ``-1`` on error.
264+
265+
.. versionadded:: 3.12
266+
267+
.. c:function:: int PyDict_Unwatch(int watcher_id, PyObject *dict)
268+
269+
Mark dictionary *dict* as no longer watched. The callback granted
270+
*watcher_id* by :c:func:`PyDict_AddWatcher` will no longer be called when
271+
*dict* is modified or deallocated. The dict must previously have been
272+
watched by this watcher. Return ``0`` on success or ``-1`` on error.
273+
274+
.. versionadded:: 3.12
260275
261276
.. c:type:: PyDict_WatchEvent
262277
263278
Enumeration of possible dictionary watcher events: ``PyDict_EVENT_ADDED``,
264279
``PyDict_EVENT_MODIFIED``, ``PyDict_EVENT_DELETED``, ``PyDict_EVENT_CLONED``,
265280
``PyDict_EVENT_CLEARED``, or ``PyDict_EVENT_DEALLOCATED``.
266281
282+
.. versionadded:: 3.12
283+
267284
.. c:type:: int (*PyDict_WatchCallback)(PyDict_WatchEvent event, PyObject *dict, PyObject *key, PyObject *new_value)
268285
269286
Type of a dict watcher callback function.
@@ -289,3 +306,5 @@ Dictionary Objects
289306
If the callback returns with an exception set, it must return ``-1``; this
290307
exception will be printed as an unraisable exception using
291308
:c:func:`PyErr_WriteUnraisable`. Otherwise it should return ``0``.
309+
310+
.. versionadded:: 3.12

Doc/c-api/memoryview.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ any other object.
5555
*mview* **must** be a memoryview instance; this macro doesn't check its type,
5656
you must do it yourself or you will risk crashes.
5757
58-
.. c:function:: Py_buffer *PyMemoryView_GET_BASE(PyObject *mview)
58+
.. c:function:: PyObject *PyMemoryView_GET_BASE(PyObject *mview)
5959
6060
Return either a pointer to the exporting object that the memoryview is based
6161
on or ``NULL`` if the memoryview has been created by one of the functions

Doc/faq/general.rst

+18-12
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,15 @@ find packages of interest to you.
125125
How does the Python version numbering scheme work?
126126
--------------------------------------------------
127127

128-
Python versions are numbered A.B.C or A.B. A is the major version number -- it
129-
is only incremented for really major changes in the language. B is the minor
130-
version number, incremented for less earth-shattering changes. C is the
131-
micro-level -- it is incremented for each bugfix release. See :pep:`6` for more
132-
information about bugfix releases.
128+
Python versions are numbered "A.B.C" or "A.B":
129+
130+
* *A* is the major version number -- it is only incremented for really major
131+
changes in the language.
132+
* *B* is the minor version number -- it is incremented for less earth-shattering
133+
changes.
134+
* *C* is the micro version number -- it is incremented for each bugfix release.
135+
136+
See :pep:`6` for more information about bugfix releases.
133137

134138
Not all releases are bugfix releases. In the run-up to a new major release, a
135139
series of development releases are made, denoted as alpha, beta, or release
@@ -139,12 +143,14 @@ Betas are more stable, preserving existing interfaces but possibly adding new
139143
modules, and release candidates are frozen, making no changes except as needed
140144
to fix critical bugs.
141145

142-
Alpha, beta and release candidate versions have an additional suffix. The
143-
suffix for an alpha version is "aN" for some small number N, the suffix for a
144-
beta version is "bN" for some small number N, and the suffix for a release
145-
candidate version is "rcN" for some small number N. In other words, all versions
146-
labeled 2.0aN precede the versions labeled 2.0bN, which precede versions labeled
147-
2.0rcN, and *those* precede 2.0.
146+
Alpha, beta and release candidate versions have an additional suffix:
147+
148+
* The suffix for an alpha version is "aN" for some small number *N*.
149+
* The suffix for a beta version is "bN" for some small number *N*.
150+
* The suffix for a release candidate version is "rcN" for some small number *N*.
151+
152+
In other words, all versions labeled *2.0aN* precede the versions labeled
153+
*2.0bN*, which precede versions labeled *2.0rcN*, and *those* precede 2.0.
148154

149155
You may also find version numbers with a "+" suffix, e.g. "2.2+". These are
150156
unreleased versions, built directly from the CPython development repository. In
@@ -429,7 +435,7 @@ With the interpreter, documentation is never far from the student as they are
429435
programming.
430436

431437
There are also good IDEs for Python. IDLE is a cross-platform IDE for Python
432-
that is written in Python using Tkinter. PythonWin is a Windows-specific IDE.
438+
that is written in Python using Tkinter.
433439
Emacs users will be happy to know that there is a very good Python mode for
434440
Emacs. All of these programming environments provide syntax highlighting,
435441
auto-indenting, and access to the interactive interpreter while coding. Consult

Doc/glossary.rst

+10
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,16 @@ Glossary
210210
A list of bytecode instructions can be found in the documentation for
211211
:ref:`the dis module <bytecodes>`.
212212

213+
callable
214+
A callable is an object that can be called, possibly with a set
215+
of arguments (see :term:`argument`), with the following syntax::
216+
217+
callable(argument1, argument2, ...)
218+
219+
A :term:`function`, and by extension a :term:`method`, is a callable.
220+
An instance of a class that implements the :meth:`~object.__call__`
221+
method is also a callable.
222+
213223
callback
214224
A subroutine function which is passed as an argument to be executed at
215225
some point in the future.

Doc/howto/descriptor.rst

+8-6
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ afterwards, :meth:`__set_name__` will need to be called manually.
847847
ORM example
848848
-----------
849849

850-
The following code is simplified skeleton showing how data descriptors could
850+
The following code is a simplified skeleton showing how data descriptors could
851851
be used to implement an `object relational mapping
852852
<https://en.wikipedia.org/wiki/Object%E2%80%93relational_mapping>`_.
853853

@@ -1535,6 +1535,8 @@ by member descriptors:
15351535
def __get__(self, obj, objtype=None):
15361536
'Emulate member_get() in Objects/descrobject.c'
15371537
# Also see PyMember_GetOne() in Python/structmember.c
1538+
if obj is None:
1539+
return self
15381540
value = obj._slotvalues[self.offset]
15391541
if value is null:
15401542
raise AttributeError(self.name)
@@ -1563,13 +1565,13 @@ variables:
15631565
class Type(type):
15641566
'Simulate how the type metaclass adds member objects for slots'
15651567

1566-
def __new__(mcls, clsname, bases, mapping):
1568+
def __new__(mcls, clsname, bases, mapping, **kwargs):
15671569
'Emulate type_new() in Objects/typeobject.c'
15681570
# type_new() calls PyTypeReady() which calls add_methods()
15691571
slot_names = mapping.get('slot_names', [])
15701572
for offset, name in enumerate(slot_names):
15711573
mapping[name] = Member(name, clsname, offset)
1572-
return type.__new__(mcls, clsname, bases, mapping)
1574+
return type.__new__(mcls, clsname, bases, mapping, **kwargs)
15731575
15741576
The :meth:`object.__new__` method takes care of creating instances that have
15751577
slots instead of an instance dictionary. Here is a rough simulation in pure
@@ -1580,7 +1582,7 @@ Python:
15801582
class Object:
15811583
'Simulate how object.__new__() allocates memory for __slots__'
15821584

1583-
def __new__(cls, *args):
1585+
def __new__(cls, *args, **kwargs):
15841586
'Emulate object_new() in Objects/typeobject.c'
15851587
inst = super().__new__(cls)
15861588
if hasattr(cls, 'slot_names'):
@@ -1593,7 +1595,7 @@ Python:
15931595
cls = type(self)
15941596
if hasattr(cls, 'slot_names') and name not in cls.slot_names:
15951597
raise AttributeError(
1596-
f'{type(self).__name__!r} object has no attribute {name!r}'
1598+
f'{cls.__name__!r} object has no attribute {name!r}'
15971599
)
15981600
super().__setattr__(name, value)
15991601

@@ -1602,7 +1604,7 @@ Python:
16021604
cls = type(self)
16031605
if hasattr(cls, 'slot_names') and name not in cls.slot_names:
16041606
raise AttributeError(
1605-
f'{type(self).__name__!r} object has no attribute {name!r}'
1607+
f'{cls.__name__!r} object has no attribute {name!r}'
16061608
)
16071609
super().__delattr__(name)
16081610

Doc/howto/logging-cookbook.rst

+2
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,8 @@ configuration::
332332
print('complete')
333333

334334

335+
.. _blocking-handlers:
336+
335337
Dealing with handlers that block
336338
--------------------------------
337339

Doc/library/asyncio-dev.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ adjusted::
149149

150150

151151
Network logging can block the event loop. It is recommended to use
152-
a separate thread for handling logs or use non-blocking IO.
152+
a separate thread for handling logs or use non-blocking IO. For example,
153+
see :ref:`blocking-handlers`.
153154

154155

155156
.. _asyncio-coroutine-not-scheduled:

0 commit comments

Comments
 (0)