Skip to content

Commit bb35505

Browse files
Merge branch 'main' into types-qualnames
2 parents 29ef7e6 + 79311cb commit bb35505

187 files changed

Lines changed: 4145 additions & 3075 deletions

File tree

Some content is hidden

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

.github/workflows/doc.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,8 @@ jobs:
5050
run: make -C Doc/ venv
5151
- name: 'Check documentation'
5252
run: make -C Doc/ check
53-
- name: 'Upload NEWS'
54-
uses: actions/upload-artifact@v3
55-
with:
56-
name: NEWS
57-
path: Doc/build/NEWS
5853
- name: 'Build HTML documentation'
5954
run: make -C Doc/ SPHINXOPTS="-q" SPHINXERRORHANDLING="-W --keep-going" html
60-
- name: 'Upload docs'
61-
uses: actions/upload-artifact@v3
62-
with:
63-
name: doc-html
64-
path: Doc/build/html
6555

6656
# Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release
6757
doctest:

Doc/c-api/apiabiversion.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ See :ref:`stable` for a discussion of API and ABI stability across versions.
5858
Thus ``3.4.1a2`` is hexversion ``0x030401a2`` and ``3.10.0`` is
5959
hexversion ``0x030a00f0``.
6060

61+
Use this for numeric comparisons, e.g. ``#if PY_VERSION_HEX >= ...``.
62+
6163
This version is also available via the symbol :data:`Py_Version`.
6264

6365
.. c:var:: const unsigned long Py_Version

Doc/c-api/structures.rst

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -228,29 +228,30 @@ Implementing functions and methods
228228
Structure used to describe a method of an extension type. This structure has
229229
four fields:
230230
231-
+------------------+---------------+-------------------------------+
232-
| Field | C Type | Meaning |
233-
+==================+===============+===============================+
234-
| :attr:`ml_name` | const char \* | name of the method |
235-
+------------------+---------------+-------------------------------+
236-
| :attr:`ml_meth` | PyCFunction | pointer to the C |
237-
| | | implementation |
238-
+------------------+---------------+-------------------------------+
239-
| :attr:`ml_flags` | int | flag bits indicating how the |
240-
| | | call should be constructed |
241-
+------------------+---------------+-------------------------------+
242-
| :attr:`ml_doc` | const char \* | points to the contents of the |
243-
| | | docstring |
244-
+------------------+---------------+-------------------------------+
245-
246-
The :attr:`ml_meth` is a C function pointer. The functions may be of different
231+
.. c:member:: const char* ml_name
232+
233+
name of the method
234+
235+
.. c:member:: PyCFunction ml_meth
236+
237+
pointer to the C implementation
238+
239+
.. c:member:: int ml_flags
240+
241+
flags bits indicating how the call should be constructed
242+
243+
.. c:member:: const char* ml_doc
244+
245+
points to the contents of the docstring
246+
247+
The :c:member:`ml_meth` is a C function pointer. The functions may be of different
247248
types, but they always return :c:expr:`PyObject*`. If the function is not of
248249
the :c:type:`PyCFunction`, the compiler will require a cast in the method table.
249250
Even though :c:type:`PyCFunction` defines the first parameter as
250251
:c:expr:`PyObject*`, it is common that the method implementation uses the
251252
specific C type of the *self* object.
252253
253-
The :attr:`ml_flags` field is a bitfield which can include the following flags.
254+
The :c:member:`ml_flags` field is a bitfield which can include the following flags.
254255
The individual flags indicate either a calling convention or a binding
255256
convention.
256257

Doc/c-api/typeobj.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ Quick Reference
147147
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
148148
| :c:member:`~PyTypeObject.tp_vectorcall` | :c:type:`vectorcallfunc` | | | | | |
149149
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
150+
| [:c:member:`~PyTypeObject.tp_watched`] | char | | | | | |
151+
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
150152

151153
.. [#slots]
152154
@@ -2090,6 +2092,13 @@ and :c:type:`PyType_Type` effectively act as defaults.)
20902092
.. versionadded:: 3.9 (the field exists since 3.8 but it's only used since 3.9)
20912093

20922094

2095+
.. c:member:: char PyTypeObject.tp_watched
2096+
2097+
Internal. Do not use.
2098+
2099+
.. versionadded:: 3.12
2100+
2101+
20932102
.. _static-types:
20942103

20952104
Static Types

Doc/howto/enum.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ And a function to display the chores for a given day::
158158
... for chore, days in chores.items():
159159
... if day in days:
160160
... print(chore)
161+
...
161162
>>> show_chores(chores_for_ethan, Weekday.SATURDAY)
162163
answer SO questions
163164

@@ -712,6 +713,7 @@ It is also possible to name the combinations::
712713
... W = 2
713714
... X = 1
714715
... RWX = 7
716+
...
715717
>>> Perm.RWX
716718
<Perm.RWX: 7>
717719
>>> ~Perm.RWX

Doc/includes/typestruct.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,7 @@ typedef struct _typeobject {
8080

8181
destructor tp_finalize;
8282
vectorcallfunc tp_vectorcall;
83+
84+
/* bitset of which type-watchers care about this type */
85+
char tp_watched;
8386
} PyTypeObject;

Doc/library/argparse.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,7 @@ arguments they contain. For example::
565565

566566
>>> with open('args.txt', 'w', encoding=sys.getfilesystemencoding()) as fp:
567567
... fp.write('-f\nbar')
568+
...
568569
>>> parser = argparse.ArgumentParser(fromfile_prefix_chars='@')
569570
>>> parser.add_argument('-f')
570571
>>> parser.parse_args(['-f', 'foo', '@args.txt'])

Doc/library/asyncio-eventloop.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,8 @@ Watching file descriptors
932932

933933
.. method:: loop.remove_reader(fd)
934934

935-
Stop monitoring the *fd* file descriptor for read availability.
935+
Stop monitoring the *fd* file descriptor for read availability. Returns
936+
``True`` if *fd* was previously being monitored for reads.
936937

937938
.. method:: loop.add_writer(fd, callback, *args)
938939

@@ -945,7 +946,8 @@ Watching file descriptors
945946

946947
.. method:: loop.remove_writer(fd)
947948

948-
Stop monitoring the *fd* file descriptor for write availability.
949+
Stop monitoring the *fd* file descriptor for write availability. Returns
950+
``True`` if *fd* was previously being monitored for writes.
949951

950952
See also :ref:`Platform Support <asyncio-platform-support>` section
951953
for some limitations of these methods.

Doc/library/asyncio-stream.rst

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ and work with streams:
5252
limit=None, ssl=None, family=0, proto=0, \
5353
flags=0, sock=None, local_addr=None, \
5454
server_hostname=None, ssl_handshake_timeout=None, \
55+
ssl_shutdown_timeout=None, \
5556
happy_eyeballs_delay=None, interleave=None)
5657

5758
Establish a network connection and return a pair of
@@ -82,14 +83,17 @@ and work with streams:
8283
.. versionchanged:: 3.10
8384
Removed the *loop* parameter.
8485

86+
.. versionchanged:: 3.11
87+
Added the *ssl_shutdown_timeout* parameter.
88+
8589

8690
.. coroutinefunction:: start_server(client_connected_cb, host=None, \
8791
port=None, *, limit=None, \
8892
family=socket.AF_UNSPEC, \
8993
flags=socket.AI_PASSIVE, sock=None, \
9094
backlog=100, ssl=None, reuse_address=None, \
9195
reuse_port=None, ssl_handshake_timeout=None, \
92-
start_serving=True)
96+
ssl_shutdown_timeout=None, start_serving=True)
9397
9498
Start a socket server.
9599

@@ -121,12 +125,15 @@ and work with streams:
121125
.. versionchanged:: 3.10
122126
Removed the *loop* parameter.
123127

128+
.. versionchanged:: 3.11
129+
Added the *ssl_shutdown_timeout* parameter.
130+
124131

125132
.. rubric:: Unix Sockets
126133

127134
.. coroutinefunction:: open_unix_connection(path=None, *, limit=None, \
128135
ssl=None, sock=None, server_hostname=None, \
129-
ssl_handshake_timeout=None)
136+
ssl_handshake_timeout=None, ssl_shutdown_timeout=None)
130137

131138
Establish a Unix socket connection and return a pair of
132139
``(reader, writer)``.
@@ -150,10 +157,14 @@ and work with streams:
150157
.. versionchanged:: 3.10
151158
Removed the *loop* parameter.
152159

160+
.. versionchanged:: 3.11
161+
Added the *ssl_shutdown_timeout* parameter.
162+
153163

154164
.. coroutinefunction:: start_unix_server(client_connected_cb, path=None, \
155165
*, limit=None, sock=None, backlog=100, ssl=None, \
156-
ssl_handshake_timeout=None, start_serving=True)
166+
ssl_handshake_timeout=None, \
167+
ssl_shutdown_timeout=None, start_serving=True)
157168
158169
Start a Unix socket server.
159170

@@ -176,6 +187,9 @@ and work with streams:
176187
.. versionchanged:: 3.10
177188
Removed the *loop* parameter.
178189

190+
.. versionchanged:: 3.11
191+
Added the *ssl_shutdown_timeout* parameter.
192+
179193

180194
StreamReader
181195
============

Doc/library/bz2.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,11 @@ Writing and reading a bzip2-compressed file in binary mode:
320320
>>> with bz2.open("myfile.bz2", "wb") as f:
321321
... # Write compressed data to file
322322
... unused = f.write(data)
323+
...
323324
>>> with bz2.open("myfile.bz2", "rb") as f:
324325
... # Decompress data from file
325326
... content = f.read()
327+
...
326328
>>> content == data # Check equality to original object after round-trip
327329
True
328330

0 commit comments

Comments
 (0)