Skip to content

Commit

Permalink
Merge remote-tracking branch 'cpython/main' into pythongh-99726
Browse files Browse the repository at this point in the history
  • Loading branch information
zooba committed Nov 28, 2022
2 parents 64111f4 + 7bae15c commit d53c013
Show file tree
Hide file tree
Showing 99 changed files with 1,682 additions and 1,351 deletions.
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,6 @@ Lib/ast.py @isidentical

# pathlib
**/*pathlib* @brettcannon

# zipfile.Path
**/*zipfile/*_path.py @jaraco
28 changes: 24 additions & 4 deletions Doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ PAPEROPT_letter = -D latex_elements.papersize=letterpaper
ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees $(PAPEROPT_$(PAPER)) -j auto \
$(SPHINXOPTS) $(SPHINXERRORHANDLING) . build/$(BUILDER) $(SOURCES)

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

.PHONY: help
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " clean to remove build files"
Expand All @@ -44,6 +41,7 @@ help:
@echo " dist to create a \"dist\" directory with archived docs for download"
@echo " check to run a check for frequent markup errors"

.PHONY: build
build:
-mkdir -p build
# Look first for a Misc/NEWS file (building from a source release tarball
Expand All @@ -70,70 +68,85 @@ build:
$(SPHINXBUILD) $(ALLSPHINXOPTS)
@echo

.PHONY: html
html: BUILDER = html
html: build
@echo "Build finished. The HTML pages are in build/html."

.PHONY: htmlhelp
htmlhelp: BUILDER = htmlhelp
htmlhelp: build
@echo "Build finished; now you can run HTML Help Workshop with the" \
"build/htmlhelp/pydoc.hhp project file."

.PHONY: latex
latex: BUILDER = latex
latex: build
@echo "Build finished; the LaTeX files are in build/latex."
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
"run these through (pdf)latex."

.PHONY: text
text: BUILDER = text
text: build
@echo "Build finished; the text files are in build/text."

.PHONY: texinfo
texinfo: BUILDER = texinfo
texinfo: build
@echo "Build finished; the python.texi file is in build/texinfo."
@echo "Run \`make info' in that directory to run it through makeinfo."

.PHONY: epub
epub: BUILDER = epub
epub: build
@echo "Build finished; the epub files are in build/epub."

.PHONY: changes
changes: BUILDER = changes
changes: build
@echo "The overview file is in build/changes."

.PHONY: linkcheck
linkcheck: BUILDER = linkcheck
linkcheck:
@$(MAKE) build BUILDER=$(BUILDER) || { \
echo "Link check complete; look for any errors in the above output" \
"or in build/$(BUILDER)/output.txt"; \
false; }

.PHONY: coverage
coverage: BUILDER = coverage
coverage: build
@echo "Coverage finished; see c.txt and python.txt in build/coverage"

.PHONY: doctest
doctest: BUILDER = doctest
doctest:
@$(MAKE) build BUILDER=$(BUILDER) || { \
echo "Testing of doctests in the sources finished, look at the" \
"results in build/doctest/output.txt"; \
false; }

.PHONY: pydoc-topics
pydoc-topics: BUILDER = pydoc-topics
pydoc-topics: build
@echo "Building finished; now run this:" \
"cp build/pydoc-topics/topics.py ../Lib/pydoc_data/topics.py"

.PHONY: htmlview
htmlview: html
$(PYTHON) -c "import os, webbrowser; webbrowser.open('file://' + os.path.realpath('build/html/index.html'))"

.PHONY: clean
clean: clean-venv
-rm -rf build/*

.PHONY: clean-venv
clean-venv:
rm -rf $(VENVDIR)

.PHONY: venv
venv:
@if [ -d $(VENVDIR) ] ; then \
echo "venv already exists."; \
Expand All @@ -145,6 +158,7 @@ venv:
echo "The venv has been created in the $(VENVDIR) directory"; \
fi

.PHONY: dist
dist:
rm -rf dist
mkdir -p dist
Expand Down Expand Up @@ -199,12 +213,14 @@ dist:
rm -r dist/python-$(DISTVERSION)-docs-texinfo
rm dist/python-$(DISTVERSION)-docs-texinfo.tar

.PHONY: check
check:
# Check the docs and NEWS files with sphinx-lint.
# Ignore the tools and venv dirs and check that the default role is not used.
$(SPHINXLINT) -i tools -i $(VENVDIR) --enable default-role
$(SPHINXLINT) --enable default-role ../Misc/NEWS.d/next/

.PHONY: serve
serve:
@echo "The serve target was removed, use htmlview instead (see bpo-36329)"

Expand All @@ -216,22 +232,26 @@ serve:
# output files)

# for development releases: always build
.PHONY: autobuild-dev
autobuild-dev:
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'

# 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
.PHONY: autobuild-stable
autobuild-stable:
@case $(DISTVERSION) in *[ab]*) \
echo "Not building; $(DISTVERSION) is not a release version."; \
exit 1;; \
esac
@make autobuild-dev

.PHONY: autobuild-stable-html
autobuild-stable-html:
@case $(DISTVERSION) in *[ab]*) \
echo "Not building; $(DISTVERSION) is not a release version."; \
Expand Down
31 changes: 25 additions & 6 deletions Doc/c-api/typeobj.rst
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,16 @@ Quick Reference
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+

.. [#slots]
A slot name in parentheses indicates it is (effectively) deprecated.
Names in angle brackets should be treated as read-only.
Names in square brackets are for internal use only.
"<R>" (as a prefix) means the field is required (must be non-``NULL``).
**()**: A slot name in parentheses indicates it is (effectively) deprecated.
**<>**: Names in angle brackets should be initially set to ``NULL`` and
treated as read-only.
**[]**: Names in square brackets are for internal use only.
**<R>** (as a prefix) means the field is required (must be non-``NULL``).
.. [#cols] Columns:
**"O"**: set on :c:type:`PyBaseObject_Type`
Expand Down Expand Up @@ -1923,8 +1929,19 @@ and :c:type:`PyType_Type` effectively act as defaults.)
Tuple of base types.

This is set for types created by a class statement. It should be ``NULL`` for
statically defined types.
This field should be set to ``NULL`` and treated as read-only.
Python will fill it in when the type is :c:func:`initialized <PyType_Ready>`.

For dynamically created classes, the ``Py_tp_bases``
:c:type:`slot <PyType_Slot>` can be used instead of the *bases* argument
of :c:func:`PyType_FromSpecWithBases`.
The argument form is preferred.

.. warning::

Multiple inheritance does not work well for statically defined types.
If you set ``tp_bases`` to a tuple, Python will not raise an error,
but some slots will only be inherited from the first base.

**Inheritance:**

Expand All @@ -1936,6 +1953,8 @@ and :c:type:`PyType_Type` effectively act as defaults.)
Tuple containing the expanded set of base types, starting with the type itself
and ending with :class:`object`, in Method Resolution Order.

This field should be set to ``NULL`` and treated as read-only.
Python will fill it in when the type is :c:func:`initialized <PyType_Ready>`.

**Inheritance:**

Expand Down
4 changes: 2 additions & 2 deletions Doc/data/refcounts.dat
Original file line number Diff line number Diff line change
Expand Up @@ -1018,10 +1018,10 @@ PyImport_Import:PyObject*::+1:
PyImport_Import:PyObject*:name:0:

PyImport_ImportFrozenModule:int:::
PyImport_ImportFrozenModule:const char*:::
PyImport_ImportFrozenModule:const char*:name::

PyImport_ImportFrozenModuleObject:int:::
PyImport_ImportFrozenModuleObject:PyObject*::+1:
PyImport_ImportFrozenModuleObject:PyObject*:name:+1:

PyImport_ImportModule:PyObject*::+1:
PyImport_ImportModule:const char*:name::
Expand Down
4 changes: 2 additions & 2 deletions Doc/library/ctypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1440,8 +1440,8 @@ copy of the windows error code.

The *winmode* parameter is used on Windows to specify how the library is loaded
(since *mode* is ignored). It takes any value that is valid for the Win32 API
``LoadLibraryEx`` flags parameter. When omitted, the default is to use the flags
that result in the most secure DLL load to avoiding issues such as DLL
``LoadLibraryEx`` flags parameter. When omitted, the default is to use the
flags that result in the most secure DLL load, which avoids issues such as DLL
hijacking. Passing the full path to the DLL is the safest way to ensure the
correct library and dependencies are loaded.

Expand Down
6 changes: 3 additions & 3 deletions Doc/library/doctest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -696,10 +696,10 @@ special Python comments following an example's source code:

.. productionlist:: doctest
directive: "#" "doctest:" `directive_options`
directive_options: `directive_option` ("," `directive_option`)\*
directive_options: `directive_option` ("," `directive_option`)*
directive_option: `on_or_off` `directive_option_name`
on_or_off: "+" \| "-"
directive_option_name: "DONT_ACCEPT_BLANKLINE" \| "NORMALIZE_WHITESPACE" \| ...
on_or_off: "+" | "-"
directive_option_name: "DONT_ACCEPT_BLANKLINE" | "NORMALIZE_WHITESPACE" | ...

Whitespace is not allowed between the ``+`` or ``-`` and the directive option
name. The directive option name can be any of the option flag names explained
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/importlib.resources.abc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
:class:`importlib.resources.abc.ResourceReader` and provides
concrete implementations of the :class:`importlib.resources.abc.ResourceReader`'s
abstract methods. Therefore, any loader supplying
:class:`importlib.abc.TraversableReader` also supplies ResourceReader.
:class:`importlib.abc.TraversableResources` also supplies ResourceReader.

Loaders that wish to support resource reading are expected to
implement this interface.
Expand Down
14 changes: 11 additions & 3 deletions Doc/library/importlib.resources.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,17 @@
.. versionadded:: 3.7

This module leverages Python's import system to provide access to *resources*
within *packages*. If you can import a package, you can access resources
within that package. Resources can be opened or read, in either binary or
text mode.
within *packages*.

"Resources" are file-like resources associated with a module or package in
Python. The resources may be contained directly in a package or within a
subdirectory contained in that package. Resources may be text or binary. As a
result, Python module sources (.py) of a package and compilation artifacts
(pycache) are technically de-facto resources of that package. In practice,
however, resources are primarily those non-Python artifacts exposed
specifically by the package author.

Resources can be opened or read in either binary or text mode.

Resources are roughly akin to files inside directories, though it's important
to keep in mind that this is just a metaphor. Resources and packages **do
Expand Down
7 changes: 1 addition & 6 deletions Doc/library/inspect.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,14 @@ The :func:`getmembers` function retrieves the members of an object such as a
class or module. The functions whose names begin with "is" are mainly
provided as convenient choices for the second argument to :func:`getmembers`.
They also help you determine when you can expect to find the following special
attributes:
attributes (see :ref:`import-mod-attrs` for module attributes):

.. this function name is too big to fit in the ascii-art table below
.. |coroutine-origin-link| replace:: :func:`sys.set_coroutine_origin_tracking_depth`

+-----------+-------------------+---------------------------+
| Type | Attribute | Description |
+===========+===================+===========================+
| module | __doc__ | documentation string |
+-----------+-------------------+---------------------------+
| | __file__ | filename (missing for |
| | | built-in modules) |
+-----------+-------------------+---------------------------+
| class | __doc__ | documentation string |
+-----------+-------------------+---------------------------+
| | __name__ | name with which this |
Expand Down
8 changes: 6 additions & 2 deletions Doc/library/multiprocessing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1089,10 +1089,14 @@ Miscellaneous
.. versionchanged:: 3.11
Accepts a :term:`path-like object`.

.. function:: set_start_method(method)
.. function:: set_start_method(method, force=False)

Set the method which should be used to start child processes.
*method* can be ``'fork'``, ``'spawn'`` or ``'forkserver'``.
The *method* argument can be ``'fork'``, ``'spawn'`` or ``'forkserver'``.
Raises :exc:`RuntimeError` if the start method has already been set and *force*
is not ``True``. If *method* is ``None`` and *force* is ``True`` then the start
method is set to ``None``. If *method* is ``None`` and *force* is ``False``
then the context is set to the default context.

Note that this should be called at most once, and it should be
protected inside the ``if __name__ == '__main__'`` clause of the
Expand Down
Loading

0 comments on commit d53c013

Please sign in to comment.