Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into pythongh-123083
Browse files Browse the repository at this point in the history
  • Loading branch information
corona10 committed Aug 21, 2024
2 parents 4237506 + b1d3bd2 commit 2603cb4
Show file tree
Hide file tree
Showing 76 changed files with 1,816 additions and 989 deletions.
49 changes: 32 additions & 17 deletions Doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -188,54 +188,69 @@ dist:
mkdir -p dist

# archive the HTML
make html
@echo "Building HTML..."
$(MAKE) html
cp -pPR build/html dist/python-$(DISTVERSION)-docs-html
tar -C dist -cf dist/python-$(DISTVERSION)-docs-html.tar python-$(DISTVERSION)-docs-html
bzip2 -9 -k dist/python-$(DISTVERSION)-docs-html.tar
(cd dist; zip -q -r -9 python-$(DISTVERSION)-docs-html.zip python-$(DISTVERSION)-docs-html)
rm -r dist/python-$(DISTVERSION)-docs-html
rm dist/python-$(DISTVERSION)-docs-html.tar
@echo "Build finished and archived!"

# archive the text build
make text
@echo "Building text..."
$(MAKE) text
cp -pPR build/text dist/python-$(DISTVERSION)-docs-text
tar -C dist -cf dist/python-$(DISTVERSION)-docs-text.tar python-$(DISTVERSION)-docs-text
bzip2 -9 -k dist/python-$(DISTVERSION)-docs-text.tar
(cd dist; zip -q -r -9 python-$(DISTVERSION)-docs-text.zip python-$(DISTVERSION)-docs-text)
rm -r dist/python-$(DISTVERSION)-docs-text
rm dist/python-$(DISTVERSION)-docs-text.tar
@echo "Build finished and archived!"

# archive the A4 latex
@echo "Building LaTeX (A4 paper)..."
rm -rf build/latex
make latex PAPER=a4
-sed -i 's/makeindex/makeindex -q/' build/latex/Makefile
(cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2)
$(MAKE) latex PAPER=a4
# remove zip & bz2 dependency on all-pdf,
# as otherwise the full latexmk process is run twice.
# ($$ is needed to escape the $; https://www.gnu.org/software/make/manual/make.html#Basics-of-Variable-References)
-sed -i 's/: all-$$(FMT)/:/' build/latex/Makefile
(cd build/latex; $(MAKE) clean && $(MAKE) --jobs=$((`nproc`+1)) --output-sync LATEXMKOPTS='-quiet' all-pdf && $(MAKE) FMT=pdf zip bz2)
cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-a4.zip
cp build/latex/docs-pdf.tar.bz2 dist/python-$(DISTVERSION)-docs-pdf-a4.tar.bz2
@echo "Build finished and archived!"

# archive the letter latex
@echo "Building LaTeX (US paper)..."
rm -rf build/latex
make latex PAPER=letter
-sed -i 's/makeindex/makeindex -q/' build/latex/Makefile
(cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2)
$(MAKE) latex PAPER=letter
-sed -i 's/: all-$$(FMT)/:/' build/latex/Makefile
(cd build/latex; $(MAKE) clean && $(MAKE) --jobs=$((`nproc`+1)) --output-sync LATEXMKOPTS='-quiet' all-pdf && $(MAKE) FMT=pdf zip bz2)
cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-letter.zip
cp build/latex/docs-pdf.tar.bz2 dist/python-$(DISTVERSION)-docs-pdf-letter.tar.bz2
@echo "Build finished and archived!"

# copy the epub build
@echo "Building EPUB..."
rm -rf build/epub
make epub
$(MAKE) epub
cp -pPR build/epub/Python.epub dist/python-$(DISTVERSION)-docs.epub
@echo "Build finished and archived!"

# archive the texinfo build
@echo "Building Texinfo..."
rm -rf build/texinfo
make texinfo
make info --directory=build/texinfo
$(MAKE) texinfo
$(MAKE) info --directory=build/texinfo
cp -pPR build/texinfo dist/python-$(DISTVERSION)-docs-texinfo
tar -C dist -cf dist/python-$(DISTVERSION)-docs-texinfo.tar python-$(DISTVERSION)-docs-texinfo
bzip2 -9 -k dist/python-$(DISTVERSION)-docs-texinfo.tar
(cd dist; zip -q -r -9 python-$(DISTVERSION)-docs-texinfo.zip python-$(DISTVERSION)-docs-texinfo)
rm -r dist/python-$(DISTVERSION)-docs-texinfo
rm dist/python-$(DISTVERSION)-docs-texinfo.tar
@echo "Build finished and archived!"

.PHONY: _ensure-package
_ensure-package: venv
Expand All @@ -247,11 +262,11 @@ _ensure-package: venv

.PHONY: _ensure-pre-commit
_ensure-pre-commit:
make _ensure-package PACKAGE=pre-commit
$(MAKE) _ensure-package PACKAGE=pre-commit

.PHONY: _ensure-sphinx-autobuild
_ensure-sphinx-autobuild:
make _ensure-package PACKAGE=sphinx-autobuild
$(MAKE) _ensure-package PACKAGE=sphinx-autobuild

.PHONY: check
check: _ensure-pre-commit
Expand All @@ -271,12 +286,12 @@ serve:
# for development releases: always build
.PHONY: autobuild-dev
autobuild-dev:
make dist SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1'
$(MAKE) dist SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1'

# for quick rebuilds (HTML only)
.PHONY: autobuild-dev-html
autobuild-dev-html:
make html SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1'
$(MAKE) html SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1'

# for stable releases: only build if not in pre-release stage (alpha, beta)
# release candidate downloads are okay, since the stable tree can be in that stage
Expand All @@ -286,12 +301,12 @@ autobuild-stable:
echo "Not building; $(DISTVERSION) is not a release version."; \
exit 1;; \
esac
@make autobuild-dev
@$(MAKE) autobuild-dev

.PHONY: autobuild-stable-html
autobuild-stable-html:
@case $(DISTVERSION) in *[ab]*) \
echo "Not building; $(DISTVERSION) is not a release version."; \
exit 1;; \
esac
@make autobuild-dev-html
@$(MAKE) autobuild-dev-html
5 changes: 5 additions & 0 deletions Doc/deprecations/pending-removal-in-3.16.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ Pending Removal in Python 3.16
* :mod:`symtable`:
Deprecate :meth:`symtable.Class.get_methods` due to the lack of interest.
(Contributed by Bénédikt Tran in :gh:`119698`.)

* :mod:`shutil`: Deprecate :class:`!shutil.ExecError`, which hasn't
been raised by any :mod:`!shutil` function since Python 3.4. It's
now an alias for :exc:`RuntimeError`.

20 changes: 16 additions & 4 deletions Doc/library/configparser.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1314,13 +1314,19 @@ RawConfigParser Objects

.. method:: add_section(section)

Add a section named *section* to the instance. If a section by the given
name already exists, :exc:`DuplicateSectionError` is raised. If the
*default section* name is passed, :exc:`ValueError` is raised.
Add a section named *section* or :const:`UNNAMED_SECTION` to the instance.

If the given section already exists, :exc:`DuplicateSectionError` is
raised. If the *default section* name is passed, :exc:`ValueError` is
raised. If :const:`UNNAMED_SECTION` is passed and support is disabled,
:exc:`UnnamedSectionDisabledError` is raised.

Type of *section* is not checked which lets users create non-string named
sections. This behaviour is unsupported and may cause internal errors.

.. versionchanged:: 3.14
Added support for :const:`UNNAMED_SECTION`.


.. method:: set(section, option, value)

Expand Down Expand Up @@ -1405,7 +1411,6 @@ Exceptions
Exception raised when attempting to parse a file which has no section
headers.


.. exception:: ParsingError

Exception raised when errors occur attempting to parse a file.
Expand All @@ -1421,6 +1426,13 @@ Exceptions

.. versionadded:: 3.13

.. exception:: UnnamedSectionDisabledError

Exception raised when attempting to use the
:const:`UNNAMED_SECTION` without enabling it.

.. versionadded:: 3.14

.. rubric:: Footnotes

.. [1] Config parsers allow for heavy customization. If you are interested in
Expand Down
48 changes: 40 additions & 8 deletions Doc/library/dis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ interpreter.
for jump targets and exception handlers. The ``-O`` command line
option and the ``show_offsets`` argument were added.

.. versionchanged:: 3.14
The :option:`-P <dis --show-positions>` command-line option
and the ``show_positions`` argument were added.

Example: Given the function :func:`!myfunc`::

def myfunc(alist):
Expand Down Expand Up @@ -85,7 +89,7 @@ The :mod:`dis` module can be invoked as a script from the command line:

.. code-block:: sh
python -m dis [-h] [-C] [-O] [infile]
python -m dis [-h] [-C] [-O] [-P] [infile]
The following options are accepted:

Expand All @@ -103,6 +107,10 @@ The following options are accepted:

Show offsets of instructions.

.. cmdoption:: -P, --show-positions

Show positions of instructions in the source code.

If :file:`infile` is specified, its disassembled code will be written to stdout.
Otherwise, disassembly is performed on compiled source code received from stdin.

Expand All @@ -116,7 +124,8 @@ The bytecode analysis API allows pieces of Python code to be wrapped in a
code.

.. class:: Bytecode(x, *, first_line=None, current_offset=None,\
show_caches=False, adaptive=False, show_offsets=False)
show_caches=False, adaptive=False, show_offsets=False,\
show_positions=False)

Analyse the bytecode corresponding to a function, generator, asynchronous
generator, coroutine, method, string of source code, or a code object (as
Expand Down Expand Up @@ -144,6 +153,9 @@ code.
If *show_offsets* is ``True``, :meth:`.dis` will include instruction
offsets in the output.

If *show_positions* is ``True``, :meth:`.dis` will include instruction
source code positions in the output.

.. classmethod:: from_traceback(tb, *, show_caches=False)

Construct a :class:`Bytecode` instance from the given traceback, setting
Expand Down Expand Up @@ -173,6 +185,12 @@ code.
.. versionchanged:: 3.11
Added the *show_caches* and *adaptive* parameters.

.. versionchanged:: 3.13
Added the *show_offsets* parameter

.. versionchanged:: 3.14
Added the *show_positions* parameter.

Example:

.. doctest::
Expand Down Expand Up @@ -226,7 +244,8 @@ operation is being performed, so the intermediate analysis object isn't useful:
Added *file* parameter.


.. function:: dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False)
.. function:: dis(x=None, *, file=None, depth=None, show_caches=False,\
adaptive=False, show_offsets=False, show_positions=False)

Disassemble the *x* object. *x* can denote either a module, a class, a
method, a function, a generator, an asynchronous generator, a coroutine,
Expand Down Expand Up @@ -265,9 +284,14 @@ operation is being performed, so the intermediate analysis object isn't useful:
.. versionchanged:: 3.11
Added the *show_caches* and *adaptive* parameters.

.. versionchanged:: 3.13
Added the *show_offsets* parameter.

.. versionchanged:: 3.14
Added the *show_positions* parameter.

.. function:: distb(tb=None, *, file=None, show_caches=False, adaptive=False,
show_offset=False)
.. function:: distb(tb=None, *, file=None, show_caches=False, adaptive=False,\
show_offset=False, show_positions=False)

Disassemble the top-of-stack function of a traceback, using the last
traceback if none was passed. The instruction causing the exception is
Expand All @@ -285,14 +309,19 @@ operation is being performed, so the intermediate analysis object isn't useful:
.. versionchanged:: 3.13
Added the *show_offsets* parameter.

.. versionchanged:: 3.14
Added the *show_positions* parameter.

.. function:: disassemble(code, lasti=-1, *, file=None, show_caches=False, adaptive=False)
disco(code, lasti=-1, *, file=None, show_caches=False, adaptive=False,
show_offsets=False)
disco(code, lasti=-1, *, file=None, show_caches=False, adaptive=False,\
show_offsets=False, show_positions=False)
Disassemble a code object, indicating the last instruction if *lasti* was
provided. The output is divided in the following columns:

#. the line number, for the first instruction of each line
#. the source code location of the instruction. Complete location information
is shown if *show_positions* is true. Otherwise (the default) only the
line number is displayed.
#. the current instruction, indicated as ``-->``,
#. a labelled instruction, indicated with ``>>``,
#. the address of the instruction,
Expand All @@ -315,6 +344,9 @@ operation is being performed, so the intermediate analysis object isn't useful:
.. versionchanged:: 3.13
Added the *show_offsets* parameter.

.. versionchanged:: 3.14
Added the *show_positions* parameter.

.. function:: get_instructions(x, *, first_line=None, show_caches=False, adaptive=False)

Return an iterator over the instructions in the supplied function, method,
Expand Down
6 changes: 3 additions & 3 deletions Doc/library/struct.rst
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ Notes:
(1)
.. index:: single: ? (question mark); in struct format strings

The ``'?'`` conversion code corresponds to the :c:expr:`_Bool` type defined by
C99. If this type is not available, it is simulated using a :c:expr:`char`. In
standard mode, it is always represented by one byte.
The ``'?'`` conversion code corresponds to the :c:expr:`_Bool` type
defined by C standards since C99. In standard mode, it is
represented by one byte.

(2)
When attempting to pack a non-integer using any of the integer conversion
Expand Down
Loading

0 comments on commit 2603cb4

Please sign in to comment.