Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/python/cpython
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamesgo1 committed Sep 29, 2023
2 parents 6e1b377 + 9c73a9a commit b0a58a1
Show file tree
Hide file tree
Showing 258 changed files with 4,721 additions and 3,154 deletions.
21 changes: 9 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,6 @@ jobs:
run: make regen-configure
- name: Build CPython
run: |
# Deepfreeze will usually cause global objects to be added or removed,
# so we run it before regen-global-objects gets rum (in regen-all).
make regen-deepfreeze
make -j4 regen-all
make regen-stdlib-module-names
- name: Check for changes
Expand Down Expand Up @@ -182,7 +179,7 @@ jobs:
- name: Display build info
run: .\python.bat -m test.pythoninfo
- name: Tests
run: .\PCbuild\rt.bat -p Win32 -d -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
run: .\PCbuild\rt.bat -p Win32 -d -q --fast-ci

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

build_win_arm64:
name: 'Windows (arm64)'
Expand Down Expand Up @@ -252,7 +249,7 @@ jobs:
- name: Display build info
run: make pythoninfo
- name: Tests
run: make buildbottest TESTOPTS="-j4 -uall,-cpu"
run: make test

build_ubuntu:
name: 'Ubuntu'
Expand All @@ -261,7 +258,7 @@ jobs:
needs: check_source
if: needs.check_source.outputs.run_tests == 'true'
env:
OPENSSL_VER: 1.1.1v
OPENSSL_VER: 3.0.11
PYTHONSTRICTEXTENSIONBUILD: 1
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -319,7 +316,7 @@ jobs:
run: sudo mount $CPYTHON_RO_SRCDIR -oremount,rw
- name: Tests
working-directory: ${{ env.CPYTHON_BUILDDIR }}
run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
run: xvfb-run make test

build_ubuntu_ssltests:
name: 'Ubuntu SSL tests with OpenSSL'
Expand All @@ -330,7 +327,7 @@ jobs:
strategy:
fail-fast: false
matrix:
openssl_ver: [1.1.1v, 3.0.10, 3.1.2]
openssl_ver: [1.1.1w, 3.0.11, 3.1.3]
env:
OPENSSL_VER: ${{ matrix.openssl_ver }}
MULTISSL_DIR: ${{ github.workspace }}/multissl
Expand Down Expand Up @@ -382,7 +379,7 @@ jobs:
needs: check_source
if: needs.check_source.outputs.run_tests == 'true' && needs.check_source.outputs.run_hypothesis == 'true'
env:
OPENSSL_VER: 1.1.1v
OPENSSL_VER: 3.0.11
PYTHONSTRICTEXTENSIONBUILD: 1
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -491,7 +488,7 @@ jobs:
needs: check_source
if: needs.check_source.outputs.run_tests == 'true'
env:
OPENSSL_VER: 1.1.1v
OPENSSL_VER: 3.0.11
PYTHONSTRICTEXTENSIONBUILD: 1
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
steps:
Expand Down Expand Up @@ -535,7 +532,7 @@ jobs:
- name: Display build info
run: make pythoninfo
- name: Tests
run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
run: xvfb-run make test

all-required-green: # This job does nothing and is only used for the branch protection
name: All required checks pass
Expand Down
2 changes: 1 addition & 1 deletion Doc/extending/windows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,4 @@ modules (including Python) to be able to see your identifiers, you have to say
Developer Studio will throw in a lot of import libraries that you do not really
need, adding about 100K to your executable. To get rid of them, use the Project
Settings dialog, Link tab, to specify *ignore default libraries*. Add the
correct :file:`msvcrtxx.lib` to the list of libraries.
correct :file:`msvcrt{xx}.lib` to the list of libraries.
4 changes: 2 additions & 2 deletions Doc/howto/logging-cookbook.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1728,7 +1728,7 @@ when (and if) the logged message is actually about to be output to a log by a
handler. So the only slightly unusual thing which might trip you up is that the
parentheses go around the format string and the arguments, not just the format
string. That's because the __ notation is just syntax sugar for a constructor
call to one of the XXXMessage classes.
call to one of the :samp:`{XXX}Message` classes.

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


.. _filters-dictconfig:
Expand Down
2 changes: 1 addition & 1 deletion Doc/howto/logging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ provided:

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

Expand Down
16 changes: 8 additions & 8 deletions Doc/howto/urllib2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ which comes after we have a look at what happens when things go wrong.
Handling Exceptions
===================

*urlopen* raises :exc:`URLError` when it cannot handle a response (though as
*urlopen* raises :exc:`~urllib.error.URLError` when it cannot handle a response (though as
usual with Python APIs, built-in exceptions such as :exc:`ValueError`,
:exc:`TypeError` etc. may also be raised).

:exc:`HTTPError` is the subclass of :exc:`URLError` raised in the specific case of
:exc:`~urllib.error.HTTPError` is the subclass of :exc:`~urllib.error.URLError` raised in the specific case of
HTTP URLs.

The exception classes are exported from the :mod:`urllib.error` module.
Expand Down Expand Up @@ -229,12 +229,12 @@ the status code indicates that the server is unable to fulfil the request. The
default handlers will handle some of these responses for you (for example, if
the response is a "redirection" that requests the client fetch the document from
a different URL, urllib will handle that for you). For those it can't handle,
urlopen will raise an :exc:`HTTPError`. Typical errors include '404' (page not
urlopen will raise an :exc:`~urllib.error.HTTPError`. Typical errors include '404' (page not
found), '403' (request forbidden), and '401' (authentication required).

See section 10 of :rfc:`2616` for a reference on all the HTTP error codes.

The :exc:`HTTPError` instance raised will have an integer 'code' attribute, which
The :exc:`~urllib.error.HTTPError` instance raised will have an integer 'code' attribute, which
corresponds to the error sent by the server.

Error Codes
Expand Down Expand Up @@ -317,7 +317,7 @@ dictionary is reproduced here for convenience ::
}

When an error is raised the server responds by returning an HTTP error code
*and* an error page. You can use the :exc:`HTTPError` instance as a response on the
*and* an error page. You can use the :exc:`~urllib.error.HTTPError` instance as a response on the
page returned. This means that as well as the code attribute, it also has read,
geturl, and info, methods as returned by the ``urllib.response`` module::

Expand All @@ -338,7 +338,7 @@ geturl, and info, methods as returned by the ``urllib.response`` module::
Wrapping it Up
--------------

So if you want to be prepared for :exc:`HTTPError` *or* :exc:`URLError` there are two
So if you want to be prepared for :exc:`~urllib.error.HTTPError` *or* :exc:`~urllib.error.URLError` there are two
basic approaches. I prefer the second approach.

Number 1
Expand All @@ -365,7 +365,7 @@ Number 1
.. note::

The ``except HTTPError`` *must* come first, otherwise ``except URLError``
will *also* catch an :exc:`HTTPError`.
will *also* catch an :exc:`~urllib.error.HTTPError`.

Number 2
~~~~~~~~
Expand All @@ -391,7 +391,7 @@ Number 2
info and geturl
===============

The response returned by urlopen (or the :exc:`HTTPError` instance) has two
The response returned by urlopen (or the :exc:`~urllib.error.HTTPError` instance) has two
useful methods :meth:`info` and :meth:`geturl` and is defined in the module
:mod:`urllib.response`..

Expand Down
58 changes: 32 additions & 26 deletions Doc/library/__future__.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,42 +22,48 @@
can be inspected programmatically via importing :mod:`__future__` and examining
its contents.

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

FeatureName = _Feature(OptionalRelease, MandatoryRelease,
CompilerFlag)
.. class:: _Feature

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

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

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

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

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

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

*MandatoryRelease* may also be ``None``, meaning that a planned feature got
dropped.
.. method:: _Feature.getMandatoryRelease()

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

*CompilerFlag* is the (bitfield) flag that should be passed in the fourth
argument to the built-in function :func:`compile` to enable the feature in
dynamically compiled code. This flag is stored in the :attr:`compiler_flag`
attribute on :class:`_Feature` instances.
Else *MandatoryRelease* records when the feature became part of the language; in
releases at or after that, modules no longer need a future statement to use the
feature in question, but may continue to use such imports.

*MandatoryRelease* may also be ``None``, meaning that a planned feature got
dropped or that it is not yet decided.

.. attribute:: _Feature.compiler_flag

*CompilerFlag* is the (bitfield) flag that should be passed in the fourth
argument to the built-in function :func:`compile` to enable the feature in
dynamically compiled code. This flag is stored in the :attr:`_Feature.compiler_flag`
attribute on :class:`_Feature` instances.

No feature description will ever be deleted from :mod:`__future__`. Since its
introduction in Python 2.1 the following features have found their way into the
Expand Down
4 changes: 2 additions & 2 deletions Doc/library/asyncio-stream.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ and work with streams:
.. versionchanged:: 3.10
Removed the *loop* parameter.

.. versionchanged:: 3.11
Added the *ssl_shutdown_timeout* parameter.
.. versionchanged:: 3.11
Added the *ssl_shutdown_timeout* parameter.


.. coroutinefunction:: start_unix_server(client_connected_cb, path=None, \
Expand Down
26 changes: 15 additions & 11 deletions Doc/library/codecs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,10 @@ The following error handlers can be used with all Python
+-------------------------+-----------------------------------------------+
| ``'backslashreplace'`` | Replace with backslashed escape sequences. |
| | On encoding, use hexadecimal form of Unicode |
| | code point with formats ``\xhh`` ``\uxxxx`` |
| | ``\Uxxxxxxxx``. On decoding, use hexadecimal |
| | form of byte value with format ``\xhh``. |
| | code point with formats :samp:`\\x{hh}` |
| | :samp:`\\u{xxxx}` :samp:`\\U{xxxxxxxx}`. |
| | On decoding, use hexadecimal form of byte |
| | value with format :samp:`\\x{hh}`. |
| | Implemented in |
| | :func:`backslashreplace_errors`. |
+-------------------------+-----------------------------------------------+
Expand All @@ -373,8 +374,9 @@ The following error handlers are only applicable to encoding (within
+=========================+===============================================+
| ``'xmlcharrefreplace'`` | Replace with XML/HTML numeric character |
| | reference, which is a decimal form of Unicode |
| | code point with format ``&#num;`` Implemented |
| | in :func:`xmlcharrefreplace_errors`. |
| | code point with format :samp:`&#{num};`. |
| | Implemented in |
| | :func:`xmlcharrefreplace_errors`. |
+-------------------------+-----------------------------------------------+
| ``'namereplace'`` | Replace with ``\N{...}`` escape sequences, |
| | what appears in the braces is the Name |
Expand Down Expand Up @@ -478,8 +480,9 @@ functions:

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

.. versionchanged:: 3.5
Works with decoding and translating.
Expand All @@ -492,7 +495,7 @@ functions:

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


.. function:: namereplace_errors(exception)
Expand Down Expand Up @@ -1346,9 +1349,10 @@ encodings.
| | | supported. |
+--------------------+---------+---------------------------+
| raw_unicode_escape | | Latin-1 encoding with |
| | | ``\uXXXX`` and |
| | | ``\UXXXXXXXX`` for other |
| | | code points. Existing |
| | | :samp:`\\u{XXXX}` and |
| | | :samp:`\\U{XXXXXXXX}` |
| | | for other code points. |
| | | Existing |
| | | backslashes are not |
| | | escaped in any way. |
| | | It is used in the Python |
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/collections.rst
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ Common patterns for working with :class:`Counter` objects::
list(c) # list unique elements
set(c) # convert to a set
dict(c) # convert to a regular dictionary
c.items() # convert to a list of (elem, cnt) pairs
c.items() # access the (elem, cnt) pairs
Counter(dict(list_of_pairs)) # convert from a list of (elem, cnt) pairs
c.most_common()[:-n-1:-1] # n least common elements
+c # remove zero and negative counts
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/compileall.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ compile Python sources.

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

.. cmdoption:: -l

Expand Down
8 changes: 8 additions & 0 deletions Doc/library/concurrent.futures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,14 @@ to a :class:`ProcessPoolExecutor` will result in deadlock.
The *max_tasks_per_child* argument was added to allow users to
control the lifetime of workers in the pool.

.. versionchanged:: 3.12
On POSIX systems, if your application has multiple threads and the
:mod:`multiprocessing` context uses the ``"fork"`` start method:
The :func:`os.fork` function called internally to spawn workers may raise a
:exc:`DeprecationWarning`. Pass a *mp_context* configured to use a
different start method. See the :func:`os.fork` documentation for
further explanation.

.. _processpoolexecutor-example:

ProcessPoolExecutor Example
Expand Down
Loading

0 comments on commit b0a58a1

Please sign in to comment.