Skip to content

Commit 159b2aa

Browse files
committed
Merge branch 'main' into supermon
* main: (26 commits) pythongh-104028: Reduce object creation while calling callback function from gc (pythongh-104030) pythongh-104036: Fix direct invocation of test_typing (python#104037) pythongh-102213: Optimize the performance of `__getattr__` (pythonGH-103761) pythongh-103895: Improve how invalid `Exception.__notes__` are displayed (python#103897) Adjust expression from `==` to `!=` in alignment with the meaning of the paragraph. (pythonGH-104021) pythongh-88496: Fix IDLE test hang on macOS (python#104025) Improve int test coverage (python#104024) pythongh-88773: Added teleport method to Turtle library (python#103974) pythongh-104015: Fix direct invocation of `test_dataclasses` (python#104017) pythongh-104012: Ensure test_calendar.CalendarTestCase.test_deprecation_warning consistently passes (python#104014) pythongh-103977: compile re expressions in platform.py only if required (python#103981) pythongh-98003: Inline call frames for CALL_FUNCTION_EX (pythonGH-98004) Replace Netlify with Read the Docs build previews (python#103843) Update name in acknowledgements and add mailmap (python#103696) pythongh-82054: allow test runner to split test_asyncio to execute in parallel by sharding. (python#103927) Remove non-existing tools from Sundry skiplist (python#103991) pythongh-103793: Defer formatting task name (python#103767) pythongh-87092: change assembler to use instruction sequence instead of CFG (python#103933) pythongh-103636: issue warning for deprecated calendar constants (python#103833) Various small fixes to dis docs (python#103923) ...
2 parents 9f1db4a + e147694 commit 159b2aa

File tree

82 files changed

+898
-1931
lines changed

Some content is hidden

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

82 files changed

+898
-1931
lines changed
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Read the Docs PR preview
2+
# Automatically edits a pull request's descriptions with a link
3+
# to the documentation's preview on Read the Docs.
4+
5+
on:
6+
pull_request_target:
7+
types:
8+
- opened
9+
paths:
10+
- 'Doc/**'
11+
- '.github/workflows/doc.yml'
12+
13+
permissions:
14+
pull-requests: write
15+
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
documentation-links:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: readthedocs/actions/preview@v1
25+
with:
26+
project-slug: "cpython-previews"
27+
single-version: "true"

.mailmap

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# This file sets the canonical name for contributors to the repository.
2+
# Documentation: https://git-scm.com/docs/gitmailmap
3+

.readthedocs.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Read the Docs configuration file
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
# Project page: https://readthedocs.org/projects/cpython-previews/
4+
5+
version: 2
6+
7+
sphinx:
8+
configuration: Doc/conf.py
9+
10+
build:
11+
os: ubuntu-22.04
12+
tools:
13+
python: "3"
14+
15+
commands:
16+
- make -C Doc venv html
17+
- mkdir _readthedocs
18+
- mv Doc/build/html _readthedocs/html

Doc/c-api/import.rst

+2
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ Importing Modules
188188
.. versionchanged:: 3.3
189189
Uses :func:`imp.source_from_cache()` in calculating the source path if
190190
only the bytecode path is provided.
191+
.. versionchanged:: 3.12
192+
No longer uses the removed ``imp`` module.
191193
192194
193195
.. c:function:: long PyImport_GetMagicNumber()

Doc/conf.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,13 @@
114114
# Short title used e.g. for <title> HTML tags.
115115
html_short_title = '%s Documentation' % release
116116

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

125126
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,

Doc/library/calendar.rst

+52
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,58 @@ interpreted as prescribed by the ISO 8601 standard. Year 0 is 1 BC, year -1 is
2828
2 BC, and so on.
2929

3030

31+
.. class:: Day
32+
33+
Enumeration defining the days of the week as integer constants, from 0 to 6.
34+
35+
.. attribute:: MONDAY
36+
37+
.. attribute:: TUESDAY
38+
39+
.. attribute:: WEDNESDAY
40+
41+
.. attribute:: THURSDAY
42+
43+
.. attribute:: FRIDAY
44+
45+
.. attribute:: SATURDAY
46+
47+
.. attribute:: SUNDAY
48+
49+
.. versionadded:: 3.12
50+
51+
52+
.. class:: Month
53+
54+
Enumeration defining months of the year as integer constants, from 1 to 12.
55+
56+
.. attribute:: JANUARY
57+
58+
.. attribute:: FEBRUARY
59+
60+
.. attribute:: MARCH
61+
62+
.. attribute:: APRIL
63+
64+
.. attribute:: MAY
65+
66+
.. attribute:: JUNE
67+
68+
.. attribute:: JULY
69+
70+
.. attribute:: AUGUST
71+
72+
.. attribute:: SEPTEMBER
73+
74+
.. attribute:: OCTOBER
75+
76+
.. attribute:: NOVEMBER
77+
78+
.. attribute:: DECEMBER
79+
80+
.. versionadded:: 3.12
81+
82+
3183
.. class:: Calendar(firstweekday=0)
3284

3385
Creates a :class:`Calendar` object. *firstweekday* is an integer specifying the

Doc/library/dataclasses.rst

+23-22
Original file line numberDiff line numberDiff line change
@@ -437,19 +437,19 @@ Module contents
437437

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

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

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

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

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

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

524-
@dataclass
525-
class C:
526-
a: float
527-
b: float
528-
c: float = field(init=False)
522+
Among other uses, this allows for initializing field values that
523+
depend on one or more other fields. For example::
529524

530-
def __post_init__(self):
531-
self.c = self.a + self.b
525+
@dataclass
526+
class C:
527+
a: float
528+
b: float
529+
c: float = field(init=False)
530+
531+
def __post_init__(self):
532+
self.c = self.a + self.b
532533

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

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

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

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

582583
For example, suppose a field will be initialized from a database, if a

0 commit comments

Comments
 (0)