8000 Catch up with justin · python/cpython@c8b5073 · GitHub
[go: up one dir, main page]

Skip to content

Commit c8b5073

Browse files
committed
Catch up with justin
2 parents ff1d6a7 + af9f114 commit c8b5073

File tree

184 files changed

+2691
-1453
lines changed

Some content is hidden

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

184 files changed

+2691
-1453
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ jobs:
182182
- name: Display build info
183183
run: .\python.bat -m test.pythoninfo
184184
- name: Tests
185-
run: .\PCbuild\rt.bat -p Win32 -d -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
185+
run: .\PCbuild\rt.bat -p Win32 -d -q --fast-ci
186186

187187
build_win_amd64:
188188
name: 'Windows (x64)'
@@ -201,7 +201,7 @@ jobs:
201201
- name: Display build info
202202
run: .\python.bat -m test.pythoninfo
203203
- name: Tests
204-
run: .\PCbuild\rt.bat -p x64 -d -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
204+
run: .\PCbuild\rt.bat -p x64 -d -q --fast-ci
205205

206206
build_win_arm64:
207207
name: 'Windows (arm64)'
@@ -252,7 +252,7 @@ jobs:
252252
- name: Display build info
253253
run: make pythoninfo
254254
- name: Tests
255-
run: make buildbottest TESTOPTS="-j4 -uall,-cpu"
255+
run: make test
256256

257257
build_ubuntu:
258258
name: 'Ubuntu'
@@ -319,7 +319,7 @@ jobs:
319319
run: sudo mount $CPYTHON_RO_SRCDIR -oremount,rw
320320
- name: Tests
321321
working-directory: ${{ env.CPYTHON_BUILDDIR }}
322-
run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
322+
run: xvfb-run make test
323323

324324
build_ubuntu_ssltests:
325325
name: 'Ubuntu SSL tests with OpenSSL'
@@ -535,7 +535,7 @@ jobs:
535535
- name: Display build info
536536
run: make pythoninfo
537537
- name: Tests
538-
run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
538+
run: xvfb-run make test
539539

540540
all-required-green: # This job does nothing and is only used for the branch protection
541541
name: All required checks pass

Doc/extending/windows.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,4 @@ modules (including Python) to be able to see your identifiers, you have to say
132132
Developer Studio will throw in a lot of import libraries that you do not really
133133
need, adding about 100K to your executable. To get rid of them, use the Project
134134
Settings dialog, Link tab, to specify *ignore default libraries*. Add the
135-
correct :file:`msvcrtxx.lib` to the list of libraries.
135+
correct :file:`msvcrt{xx}.lib` to the list of libraries.

Doc/howto/logging-cookbook.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,7 +1728,7 @@ when (and if) the logged message is actually about to be output to a log by a
17281728
handler. So the only slightly unusual thing which might trip you up is that the
17291729
parentheses go around the format string and the arguments, not just the format
17301730
string. That's because the __ notation is just syntax sugar for a constructor
1731-
call to one of the XXXMessage classes.
1731+
call to one of the :samp:`{XXX}Message` classes.
17321732

17331733
If you prefer, you can use a :class:`LoggerAdapter` to achieve a similar effect
17341734
to the above, as in the following example::
@@ -2644,7 +2644,7 @@ when (and if) the logged message is actually about to be output to a log by a
26442644
handler. So the only slightly unusual thing which might trip you up is that the
26452645
parentheses go around the format string and the arguments, not just the format
26462646
string. That’s because the __ notation is just syntax sugar for a constructor
2647-
call to one of the ``XXXMessage`` classes shown above.
2647+
call to one of the :samp:`{XXX}Message` classes shown above.
26482648

26492649

26502650
.. _filters-dictconfig:

Doc/howto/logging.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ provided:
979979

980980
#. :class:`NullHandler` instances do nothing with error messages. They are used
981981
by library developers who want to use logging, but want to avoid the 'No
982-
handlers could be found for logger XXX' message which can be displayed if
982+
handlers could be found for logger *XXX*' message which can be displayed if
983983
the library user has not configured logging. See :ref:`library-config` for
984984
more information.
985985

Doc/library/__future__.rst

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,42 +22,48 @@
2222
can be inspected programmatically via importing :mod:`__future__` and examining
2323
its contents.
2424

25-
Each statement in :file:`__future__.py` is of the form::
25+
.. _future-classes:
2626

27-
FeatureName = _Feature(OptionalRelease, MandatoryRelease,
28-
CompilerFlag)
27+
.. class:: _Feature
2928

29+
Each statement in :file:`__future__.py` is of the form::
3030

31-
where, normally, *OptionalRelease* is less than *MandatoryRelease*, and both are
32-
5-tuples of the same form as :data:`sys.version_info`::
31+
FeatureName = _Feature(OptionalRelease, MandatoryRelease,
32+
CompilerFlag)
3333

34-
(PY_MAJOR_VERSION, # the 2 in 2.1.0a3; an int
35-
PY_MINOR_VERSION, # the 1; an int
36-
PY_MICRO_VERSION, # the 0; an int
37-
PY_RELEASE_LEVEL, # "alpha", "beta", "candidate" or "final"; string
38-
PY_RELEASE_SERIAL # the 3; an int
39-
)
34+
where, normally, *OptionalRelease* is less than *MandatoryRelease*, and both are
35+
5-tuples of the same form as :data:`sys.version_info`::
4036

41-
*OptionalRelease* records the first release in which the feature was accepted.
37+
(PY_MAJOR_VERSION, # the 2 in 2.1.0a3; an int
38+
PY_MINOR_VERSION, # the 1; an int
39+
PY_MICRO_VERSION, # the 0; an int
40+
PY_RELEASE_LEVEL, # "alpha", "beta", "candidate" or "final"; string
41+
PY_RELEASE_SERIAL # the 3; an int
42+
)
4243

43-
In the case of a *MandatoryRelease* that has not yet occurred,
44-
*MandatoryRelease* predicts the release in which the feature will become part of
45-
the language.
44+
.. method:: _Feature.getOptionalRelease()
4645

47-
Else *MandatoryRelease* records when the feature became part of the language; in
48-
releases at or after that, modules no longer need a future statement to use the
49-
feature in question, but may continue to use such imports.
46+
*OptionalRelease* records the first release in which the feature was accepted.
5047

51-
*MandatoryRelease* may also be ``None``, meaning that a planned feature got
52-
dropped.
48+
.. method:: _Feature.getMandatoryRelease()
5349

54-
Instances of class :class:`_Feature` have two corresponding methods,
55-
:meth:`getOptionalRelease` and :meth:`getMandatoryRelease`.
50+
In the case of a *MandatoryRelease* that has not yet occurred,
51+
*MandatoryRelease* predicts the release in which the feature will become part of
52+
the language.
5653

57-
*CompilerFlag* is the (bitfield) flag that should be passed in the fourth
58-
argument to the built-in function :func:`compile` to enable the feature in
59-
dynamically compiled code. This flag is stored in the :attr:`compiler_flag`
60-
attribute on :class:`_Feature` instances.
54+
Else *MandatoryRelease* records when the feature became part of the language; in
55+
releases at or after that, modules no longer need a future statement to use the
56+
feature in question, but may continue to use such imports.
57+
58+
*MandatoryRelease* may also be ``None``, meaning that a planned feature got
59+
dropped or that it is not yet decided.
60+
61+
.. attribute:: _Feature.compiler_flag
62+
63+
*CompilerFlag* is the (bitfield) flag that should be passed in the fourth
64+
argument to the built-in function :func:`compile` to enable the feature in
65+
dynamically compiled code. This flag is stored in the :attr:`_Feature.compiler_flag`
66+
attribute on :class:`_Feature` instances.
6167

6268
No feature description will ever be deleted from :mod:`__future__`. Since its
6369
introduction in Python 2.1 the following features have found their way into the

Doc/library/codecs.rst

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,10 @@ The following error handlers can be used with all Python
345345
+-------------------------+-----------------------------------------------+
346346
| ``'backslashreplace'`` | Replace with backslashed escape sequences. |
347347
| | On encoding, use hexadecimal form of Unicode |
348-
| | code point with formats ``\xhh`` ``\uxxxx`` |
349-
| | ``\Uxxxxxxxx``. On decoding, use hexadecimal |
350-
| | form of byte value with format ``\xhh``. |
348+
| | code point with formats :samp:`\\x{hh}` |
349+
| | :samp:`\\u{xxxx}` :samp:`\\U{xxxxxxxx}`. |
350+
| | On decoding, use hexadecimal form of byte |
351+
| | value with format :samp:`\\x{hh}`. |
351352
| | Implemented in |
352353
| | :func:`backslashreplace_errors`. |
353354
+-------------------------+-----------------------------------------------+
@@ -373,8 +374,9 @@ The following error handlers are only applicable to encoding (within
373374
+=========================+===============================================+
374375
| ``'xmlcharrefreplace'`` | Replace with XML/HTML numeric character |
375376
| | reference, which is a decimal form of Unicode |
376-
| | code point with format ``&#num;`` Implemented |
377-
| | in :func:`xmlcharrefreplace_errors`. |
377+
| | code point with format :samp:`&#{num};`. |
378+
| | Implemented in |
379+
| | :func:`xmlcharrefreplace_errors`. |
378380
+-------------------------+-----------------------------------------------+
379381
| ``'namereplace'`` | Replace with ``\N{...}`` escape sequences, |
380382
| | what appears in the braces is the Name |
@@ -478,8 +480,9 @@ functions:
478480

479481
Malformed data is replaced by a backslashed escape sequence.
480482
On encoding, use the hexadecimal form of Unicode code point with formats
481-
``\xhh`` ``\uxxxx`` ``\Uxxxxxxxx``. On decoding, use the hexadecimal form of
482-
byte value with format ``\xhh``.
483+
:samp:`\\x{hh}` :samp:`\\u{xxxx}` :samp:`\\U{xxxxxxxx}`.
484+
On decoding, use the hexadecimal form of
485+
byte value with format :samp:`\\x{hh}`.
483486

484487
.. versionchanged:: 3.5
485488
Works with decoding and translating.
@@ -492,7 +495,7 @@ functions:
492495

493496
The unencodable character is replaced by an appropriate XML/HTML numeric
494497
character reference, which is a decimal form of Unicode code point with
495-
format ``&#num;`` .
498+
format :samp:`&#{num};` .
496499

497500

498501
.. function:: namereplace_errors(exception)
@@ -1346,9 +1349,10 @@ encodings.
13461349
| | | supported. |
13471350
+--------------------+---------+---------------------------+
13481351
| raw_unicode_escape | | Latin-1 encoding with |
1349-
| | | ``\uXXXX`` and |
1350-
| | | ``\UXXXXXXXX`` for other |
1351-
| | | code points. Existing |
1352+
| | | :samp:`\\u{XXXX}` and |
1353+
| | | :samp:`\\U{XXXXXXXX}`` |
1354+
| | | for other code points. |
1355+
| | | Existing |
13521356
| | | backslashes are not |
13531357
| | | escaped in any way. |
13541358
| | | It is used in the Python |

Doc/library/compileall.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ compile Python sources.
3131

3232
Positional arguments are files to compile or directories that contain
3333
source files, traversed recursively. If no argument is given, behave as if
34-
the command line was ``-l <directories from sys.path>``.
34+
the command line was :samp:`-l {<directories from sys.path>}`.
3535

3636
.. cmdoption:: -l
3737

Doc/library/concurrent.futures.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,14 @@ to a :class:`ProcessPoolExecutor` will result in deadlock.
293293
The *max_tasks_per_child* argument was added to allow users to
294294
control the lifetime of workers in the pool.
295295

296+
.. versionchanged:: 3.12
297+
On POSIX systems, if your application has multiple threads and the
298+
:mod:`multiprocessing` context uses the ``"fork"`` start method:
299+
The :func:`os.fork` function called internally to spawn workers may raise a
300+
:exc:`DeprecationWarning`. Pass a *mp_context* configured to use a
301+
different start method. See the :func:`os.fork` documentation for
302+
further explanation.
303+
296304
.. _processpoolexecutor-example:
297305

298306
ProcessPoolExecutor Example

Doc/library/devmode.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ Effects of the Python Development Mode:
5959
``default``.
6060

6161
* Call :func:`faulthandler.enable` at Python startup to install handlers for
62-
the :const:`SIGSEGV`, :const:`SIGFPE`, :const:`SIGABRT`, :const:`SIGBUS` and
63-
:const:`SIGILL` signals to dump the Python traceback on a crash.
62+
the :const:`~signal.SIGSEGV`, :const:`~signal.SIGFPE`,
63+
:const:`~signal.SIGABRT`, :const:`~signal.SIGBUS` and
64+
:const:`~signal.SIGILL` signals to dump the Python traceback on a crash.
6465

6566
It behaves as if the :option:`-X faulthandler <-X>` command line option is
6667
used or if the :envvar:`PYTHONFAULTHANDLER` environment variable is set to

Doc/library/ensurepip.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ By default, ``pip`` is installed into the current virtual environment
6161
active virtual environment). The installation location can be controlled
6262
through two additional command line options:
6363

64-
* ``--root <dir>``: Installs ``pip`` relative to the given root directory
64+
* :samp:`--root {dir}`: Installs ``pip`` relative to the given root directory
6565
rather than the root of the currently active virtual environment (if any)
6666
or the default root for the current Python installation.
6767
* ``--user``: Installs ``pip`` into the user site packages directory rather

Doc/library/functions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,7 @@ are always available. They are listed here in alphabetical order.
12711271

12721272
* ``'xmlcharrefreplace'`` is only supported when writing to a file.
12731273
Characters not supported by the encoding are replaced with the
1274-
appropriate XML character reference ``&#nnn;``.
1274+
appropriate XML character reference :samp:`&#{nnn};`.
12751275

12761276
* ``'backslashreplace'`` replaces malformed data by Python's backslashed
12771277
escape sequences.

Doc/library/html.parser.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ implementations do nothing (except for :meth:`~HTMLParser.handle_startendtag`):
173173
.. method:: HTMLParser.handle_charref(name)
174174

175175
This method is called to process decimal and hexadecimal numeric character
176-
references of the form ``&#NNN;`` and ``&#xNNN;``. For example, the decimal
176+
references of the form :samp:`&#{NNN};` and :samp:`&#x{NNN};`. For example, the decimal
177177
equivalent for ``&gt;`` is ``&#62;``, whereas the hexadecimal is ``&#x3E;``;
178178
in this case the method will receive ``'62'`` or ``'x3E'``. This method
179179
is never called if *convert_charrefs* is ``True``.

Doc/library/http.server.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ provides three different variants:
217217
attribute holds the default values for *message* and *explain* that
218218
will be used if no value is provided; for unknown codes the default value
219219
for both is the string ``???``. The body will be empty if the method is
220-
HEAD or the response code is one of the following: ``1xx``,
220+
HEAD or the response code is one of the following: :samp:`1{xx}`,
221221
``204 No Content``, ``205 Reset Content``, ``304 Not Modified``.
222222

223223
.. versionchanged:: 3.4

Doc/library/multiprocessing.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ to start a process. These *start methods* are
131131
Code that requires *fork* should explicitly specify that via
132132
:func:`get_context` or :func:`set_start_method`.
133133

134+
.. versionchanged:: 3.12
135+
If Python is able to detect that your process has multiple threads, the
136+
:func:`os.fork` function that this start method calls internally will
137+
raise a :exc:`DeprecationWarning`. Use a different start method.
138+
See the :func:`os.fork` documentation for further explanation.
139+
134140
*forkserver*
135141
When the program starts and selects the *forkserver* start method,
136142
a server process is spawned. From then on, whenever a new process

Doc/library/os.rst

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ startup by the :c:func:`PyConfig_Read` function: see
8888
On some systems, conversion using the file system encoding may fail. In this
8989
case, Python uses the :ref:`surrogateescape encoding error handler
9090
<surrogateescape>`, which means that undecodable bytes are replaced by a
91-
Unicode character U+DCxx on decoding, and these are again translated to the
92-
original byte on encoding.
91+
Unicode character U+DC\ *xx* on decoding, and these are again
92+
translated to the original byte on encoding.
9393

9494

9595
The :term:`file system encoding <filesystem encoding and error handler>` must
@@ -4157,15 +4157,38 @@ written in Python, such as a mail server's external command delivery program.
41574157

41584158
.. audit-event:: os.fork "" os.fork
41594159

4160+
.. warning::
4161+
4162+
If you use TLS sockets in an application calling ``fork()``, see
4163+
the warning in the :mod:`ssl` documentation.
4164+
41604165
.. versionchanged:: 3.8
41614166
Calling ``fork()`` in a subinterpreter is no longer supported
41624167
(:exc:`RuntimeError` is raised).
41634168

4164-
.. warning::
4165-
4166-
See :mod:`ssl` for applications that use the SSL module with fork().
4169+
.. versionchanged:: 3.12
4170+
If Python is able to detect that your process has multiple
4171+
threads, :func:`os.fork` now raises a :exc:`DeprecationWarning`.
4172+
4173+
We chose to surface this as a warning, when detectable, to better
4174+
inform developers of a design problem that the POSIX platform
4175+
specifically notes as not supported. Even in code that
4176+
*appears* to work, it has never been safe to mix threading with
4177+
:func:`os.fork` on POSIX platforms. The CPython runtime itself has
4178+
always made API calls that are not safe for use in the child
4179+
process when threads existed in the parent (such as ``malloc`` and
4180+
``free``).
4181+
4182+
Users of macOS or users of libc or malloc implementations other
4183+
than those typically found in glibc to date are among those
4184+
already more likely to experience deadlocks running such code.
4185+
4186+
See `this discussion on fork being incompatible with threads
4187+
<https://discuss.python.org/t/33555>`_
4188+
for technical details of why we're surfacing this longstanding
4189+
platform compatibility problem to developers.
41674190

4168-
.. availability:: Unix, not Emscripten, not WASI.
4191+
.. availability:: POSIX, not Emscripten, not WASI.
41694192

41704193

41714194
.. function:: forkpty()
@@ -4178,6 +4201,11 @@ written in Python, such as a mail server's external command delivery program.
41784201

41794202
.. audit-event:: os.forkpty "" os.forkpty
41804203

4204+
.. versionchanged:: 3.12
4205+
If Python is able to detect that your process has multiple
4206+
threads, this now raises a :exc:`DeprecationWarning`. See the
4207+
longer explanation on :func:`os.fork`.
4208+
41814209
.. versionchanged:: 3.8
41824210
Calling ``forkpty()`` in a subinterpreter is no longer supported
41834211
(:exc:`RuntimeError` is raised).

Doc/library/pathlib.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,15 +1381,19 @@ call fails (for example because the path doesn't exist).
13811381
>>> p.resolve()
13821382
PosixPath('/home/antoine/pathlib/setup.py')
13831383

1384-
If the path doesn't exist and *strict* is ``True``, :exc:`FileNotFoundError`
1385-
is raised. If *strict* is ``False``, the path is resolved as far as possible
1386-
and any remainder is appended without checking whether it exists. If an
1387-
infinite loop is encountered along the resolution path, :exc:`RuntimeError`
1388-
is raised.
1384+
If a path doesn't exist or a symlink loop is encountered, and *strict* is
1385+
``True``, :exc:`OSError` is raised. If *strict* is ``False``, the path is
1386+
resolved as far as possible and any remainder is appended without checking
1387+
whether it exists.
13891388

13901389
.. versionchanged:: 3.6
13911390
The *strict* parameter was added (pre-3.6 behavior is strict).
13921391

1392+
.. versionchanged:: 3.13
1393+
Symlink loops are treated like other errors: :exc:`OSError` is raised in
1394+
strict mode, and no exception is raised in non-strict mode. In previous
1395+
versions, :exc:`RuntimeError` is raised no matter the value of *strict*.
1396+
13931397
.. method:: Path.rglob(pattern, *, case_sensitive=None, follow_symlinks=None)
13941398

13951399
Glob the given relative *pattern* recursively. This is like calling

Doc/library/re.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ three digits in length.
660660
Unknown escapes consisting of ``'\'`` and an ASCII letter now are errors.
661661

662662
.. versionchanged:: 3.8
663-
The ``'\N{name}'`` escape sequence has been added. As in string literals,
663+
The :samp:`'\\N\\{{name}\\}'` escape sequence has been added. As in string literals,
664664
it expands to the named Unicode character (e.g. ``'\N{EM DASH}'``).
665665

666666

0 commit comments

Comments
 (0)
0