Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
c3453fb
Update itertool recipe: polynomial_from_roots() (GH-103973)
rhettinger Apr 28, 2023
83aa496
gh-101100: Add reference doc for __post_init__ (#103818)
olgarithms Apr 28, 2023
ebf97c5
gh-103978: avoid using 'class' as an identifier (#103979)
carljm Apr 28, 2023
689723a
GH-103944: Check error status when raising DeprecationWarning (#103949)
pganssle Apr 28, 2023
79b9db9
GH-103971: Forward-port test from GH-103980 (GH-103984)
gaogaotiantian Apr 28, 2023
e1f1464
gh-98040: Remove just the `imp` module (#98573)
warsaw Apr 28, 2023
738c226
GH-103082: Code cleanup in instrumentation code (#103474)
markshannon Apr 29, 2023
ed29f52
Various small fixes to dis docs (#103923)
JelleZijlstra Apr 29, 2023
84e7d0f
gh-103636: issue warning for deprecated calendar constants (#103833)
Agent-Hellboy Apr 29, 2023
fbf3596
gh-87092: change assembler to use instruction sequence instead of CFG…
iritkatriel Apr 29, 2023
85c7bf5
gh-103793: Defer formatting task name (#103767)
itamaro Apr 29, 2023
00e2c59
Remove non-existing tools from Sundry skiplist (#103991)
arhadthedev Apr 29, 2023
9e011e7
gh-82054: allow test runner to split test_asyncio to execute in paral…
zitterbewegung Apr 30, 2023
4b10ecc
Update name in acknowledgements and add mailmap (#103696)
amyreese Apr 30, 2023
accb417
Replace Netlify with Read the Docs build previews (#103843)
hugovk Apr 30, 2023
ed95e8c
gh-98003: Inline call frames for CALL_FUNCTION_EX (GH-98004)
Fidget-Spinner Apr 30, 2023
f186557
gh-103977: compile re expressions in platform.py only if required (#1…
eendebakpt Apr 30, 2023
7d3931e
gh-104012: Ensure test_calendar.CalendarTestCase.test_deprecation_war…
AlexWaygood Apr 30, 2023
654d44b
gh-104015: Fix direct invocation of `test_dataclasses` (#104017)
sobolevn Apr 30, 2023
74a2b79
gh-88773: Added teleport method to Turtle library (#103974)
liam-gersten Apr 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/documentation-links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Read the Docs PR preview
# Automatically edits a pull request's descriptions with a link
# to the documentation's preview on Read the Docs.

on:
pull_request_target:
types:
- opened
paths:
- 'Doc/**'
- '.github/workflows/doc.yml'

permissions:
pull-requests: write

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
documentation-links:
runs-on: ubuntu-latest
steps:
- uses: readthedocs/actions/preview@v1
with:
project-slug: "cpython-previews"
single-version: "true"
3 changes: 3 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This file sets the canonical name for contributors to the repository.
# Documentation: https://git-scm.com/docs/gitmailmap
Amethyst Reese <[email protected]> <[email protected]>
18 changes: 18 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Project page: https://readthedocs.org/projects/cpython-previews/

version: 2

sphinx:
configuration: Doc/conf.py

build:
os: ubuntu-22.04
tools:
python: "3"

commands:
- make -C Doc venv html
- mkdir _readthedocs
- mv Doc/build/html _readthedocs/html
2 changes: 2 additions & 0 deletions Doc/c-api/import.rst
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ Importing Modules
.. versionchanged:: 3.3
Uses :func:`imp.source_from_cache()` in calculating the source path if
only the bytecode path is provided.
.. versionchanged:: 3.12
No longer uses the removed ``imp`` module.


.. c:function:: long PyImport_GetMagicNumber()
Expand Down
11 changes: 6 additions & 5 deletions Doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,13 @@
# Short title used e.g. for <title> HTML tags.
html_short_title = '%s Documentation' % release

# Deployment preview information, from Netlify
# (See netlify.toml and https://docs.netlify.com/configure-builds/environment-variables/#git-metadata)
# Deployment preview information
# (See .readthedocs.yml and https://docs.readthedocs.io/en/stable/reference/environment-variables.html)
repository_url = os.getenv("READTHEDOCS_GIT_CLONE_URL")
html_context = {
"is_deployment_preview": os.getenv("IS_DEPLOYMENT_PREVIEW"),
"repository_url": os.getenv("REPOSITORY_URL"),
"pr_id": os.getenv("REVIEW_ID")
"is_deployment_preview": os.getenv("READTHEDOCS_VERSION_TYPE") == "external",
"repository_url": repository_url.removesuffix(".git") if repository_url else None,
"pr_id": os.getenv("READTHEDOCS_VERSION")
}

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
Expand Down
52 changes: 52 additions & 0 deletions Doc/library/calendar.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,58 @@ interpreted as prescribed by the ISO 8601 standard. Year 0 is 1 BC, year -1 is
2 BC, and so on.


.. class:: Day

Enumeration defining the days of the week as integer constants, from 0 to 6.

.. attribute:: MONDAY

.. attribute:: TUESDAY

.. attribute:: WEDNESDAY

.. attribute:: THURSDAY

.. attribute:: FRIDAY

.. attribute:: SATURDAY

.. attribute:: SUNDAY

.. versionadded:: 3.12


.. class:: Month

Enumeration defining months of the year as integer constants, from 1 to 12.

.. attribute:: JANUARY

.. attribute:: FEBRUARY

.. attribute:: MARCH

.. attribute:: APRIL

.. attribute:: MAY

.. attribute:: JUNE

.. attribute:: JULY

.. attribute:: AUGUST

.. attribute:: SEPTEMBER

.. attribute:: OCTOBER

.. attribute:: NOVEMBER

.. attribute:: DECEMBER

.. versionadded:: 3.12


.. class:: Calendar(firstweekday=0)

Creates a :class:`Calendar` object. *firstweekday* is an integer specifying the
Expand Down
45 changes: 23 additions & 22 deletions Doc/library/dataclasses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -437,19 +437,19 @@ Module contents

The newly returned object is created by calling the :meth:`~object.__init__`
method of the dataclass. This ensures that
:ref:`__post_init__ <post-init-processing>`, if present, is also called.
:meth:`__post_init__`, if present, is also called.

Init-only variables without default values, if any exist, must be
specified on the call to :func:`replace` so that they can be passed to
:meth:`~object.__init__` and :ref:`__post_init__ <post-init-processing>`.
:meth:`~object.__init__` and :meth:`__post_init__`.

It is an error for ``changes`` to contain any fields that are
defined as having ``init=False``. A :exc:`ValueError` will be raised
in this case.

Be forewarned about how ``init=False`` fields work during a call to
:func:`replace`. They are not copied from the source object, but
rather are initialized in :ref:`__post_init__ <post-init-processing>`, if they're
rather are initialized in :meth:`__post_init__`, if they're
initialized at all. It is expected that ``init=False`` fields will
be rarely and judiciously used. If they are used, it might be wise
to have alternate class constructors, or perhaps a custom
Expand Down Expand Up @@ -510,30 +510,31 @@ Module contents
Post-init processing
--------------------

The generated :meth:`~object.__init__` code will call a method named
:meth:`!__post_init__`, if :meth:`!__post_init__` is defined on the
class. It will normally be called as ``self.__post_init__()``.
However, if any ``InitVar`` fields are defined, they will also be
passed to :meth:`!__post_init__` in the order they were defined in the
class. If no :meth:`~object.__init__` method is generated, then
:meth:`!__post_init__` will not automatically be called.
.. function:: __post_init__()

Among other uses, this allows for initializing field values that
depend on one or more other fields. For example::
When defined on the class, it will be called by the generated
:meth:`~object.__init__`, normally as ``self.__post_init__()``.
However, if any ``InitVar`` fields are defined, they will also be
passed to :meth:`__post_init__` in the order they were defined in the
class. If no :meth:`~object.__init__` method is generated, then
:meth:`__post_init__` will not automatically be called.

@dataclass
class C:
a: float
b: float
c: float = field(init=False)
Among other uses, this allows for initializing field values that
depend on one or more other fields. For example::

def __post_init__(self):
self.c = self.a + self.b
@dataclass
class C:
a: float
b: float
c: float = field(init=False)

def __post_init__(self):
self.c = self.a + self.b

The :meth:`~object.__init__` method generated by :func:`dataclass` does not call base
class :meth:`~object.__init__` methods. If the base class has an :meth:`~object.__init__` method
that has to be called, it is common to call this method in a
:meth:`!__post_init__` method::
:meth:`__post_init__` method::

@dataclass
class Rectangle:
Expand All @@ -552,7 +553,7 @@ don't need to be called, since the derived dataclass will take care of
initializing all fields of any base class that is a dataclass itself.

See the section below on init-only variables for ways to pass
parameters to :meth:`!__post_init__`. Also see the warning about how
parameters to :meth:`__post_init__`. Also see the warning about how
:func:`replace` handles ``init=False`` fields.

Class variables
Expand All @@ -576,7 +577,7 @@ is an ``InitVar``, it is considered a pseudo-field called an init-only
field. As it is not a true field, it is not returned by the
module-level :func:`fields` function. Init-only fields are added as
parameters to the generated :meth:`~object.__init__` method, and are passed to
the optional :ref:`__post_init__ <post-init-processing>` method. They are not otherwise used
the optional :meth:`__post_init__` method. They are not otherwise used
by dataclasses.

For example, suppose a field will be initialized from a database, if a
Expand Down
Loading