Skip to content

Commit 24e1159

Browse files
committed
Merge branch 'main' into superbadgetattro
* main: CI: Temporarily skip paths with spaces to avoid error (python#105110) pythongh-105071: add missing versionadded directive (python#105097) pythongh-80064: Fix is_valid_wide_char() return type (python#105099) Small speedup for dataclass __eq__ and __repr__ (python#104904) pythongh-103921: Minor PEP-695 fixes to the `ast` module docs (python#105093) pythongh-105091: stable_abi.py: Remove "Unixy" check from --all on other platforms (pythonGH-105092)
2 parents 8fff072 + 4c77061 commit 24e1159

File tree

6 files changed

+36
-16
lines changed

6 files changed

+36
-16
lines changed

Diff for: .github/workflows/build.yml

+14-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,20 @@ jobs:
8787
with:
8888
filter: |
8989
Doc/**
90-
Misc/**
90+
# Temporarily skip paths with spaces
91+
# (i.e. "C API", "Core and Builtins")
92+
# to avoid "Error: One of your files includes a space".
93+
# Pending https://github.com/python/core-workflow/issues/186
94+
# Misc/**
95+
Misc/NEWS.d/next/Build/**
96+
Misc/NEWS.d/next/Documentation/**
97+
Misc/NEWS.d/next/IDLE/**
98+
Misc/NEWS.d/next/Library/**
99+
Misc/NEWS.d/next/Security/**
100+
Misc/NEWS.d/next/Tests/**
101+
Misc/NEWS.d/next/Tools-Demos/**
102+
Misc/NEWS.d/next/Windows/**
103+
Misc/NEWS.d/next/macOS/**
91104
.github/workflows/reusable-docs.yml
92105
- name: Check for docs changes
93106
if: >-

Diff for: Doc/c-api/exceptions.rst

+2
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,8 @@ Exception Objects
783783
Return the :exc:`ExceptionGroup` that needs to be reraised in the end, or
784784
``None`` if there is nothing to reraise.
785785
786+
.. versionadded:: 3.12
787+
786788
.. _unicodeexceptions:
787789
788790
Unicode Exception Objects

Diff for: Doc/library/ast.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -1744,17 +1744,17 @@ aliases.
17441744
Function and class definitions
17451745
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17461746

1747-
.. class:: FunctionDef(name, type_params, args, body, decorator_list, returns, type_comment)
1747+
.. class:: FunctionDef(name, args, body, decorator_list, returns, type_comment, type_params)
17481748

17491749
A function definition.
17501750

17511751
* ``name`` is a raw string of the function name.
1752-
* ``type_params`` is a list of :ref:`type parameters <ast-type-params>`.
17531752
* ``args`` is an :class:`arguments` node.
17541753
* ``body`` is the list of nodes inside the function.
17551754
* ``decorator_list`` is the list of decorators to be applied, stored outermost
17561755
first (i.e. the first in the list will be applied last).
17571756
* ``returns`` is the return annotation.
1757+
* ``type_params`` is a list of :ref:`type parameters <ast-type-params>`.
17581758

17591759
.. attribute:: type_comment
17601760

@@ -1917,19 +1917,19 @@ Function and class definitions
19171917
type_ignores=[])
19181918

19191919

1920-
.. class:: ClassDef(name, type_params, bases, keywords, body, decorator_list)
1920+
.. class:: ClassDef(name, bases, keywords, body, decorator_list, type_params)
19211921

19221922
A class definition.
19231923

19241924
* ``name`` is a raw string for the class name
1925-
* ``type_params`` is a list of :ref:`type parameters <ast-type-params>`.
19261925
* ``bases`` is a list of nodes for explicitly specified base classes.
19271926
* ``keywords`` is a list of :class:`keyword` nodes, principally for 'metaclass'.
19281927
Other keywords will be passed to the metaclass, as per `PEP-3115
19291928
<https://peps.python.org/pep-3115/>`_.
19301929
* ``body`` is a list of nodes representing the code within the class
19311930
definition.
19321931
* ``decorator_list`` is a list of nodes, as in :class:`FunctionDef`.
1932+
* ``type_params`` is a list of :ref:`type parameters <ast-type-params>`.
19331933

19341934
.. doctest::
19351935

@@ -1961,7 +1961,7 @@ Function and class definitions
19611961
Async and await
19621962
^^^^^^^^^^^^^^^
19631963

1964-
.. class:: AsyncFunctionDef(name, args, body, decorator_list, returns, type_comment)
1964+
.. class:: AsyncFunctionDef(name, args, body, decorator_list, returns, type_comment, type_params)
19651965

19661966
An ``async def`` function definition. Has the same fields as
19671967
:class:`FunctionDef`.

Diff for: Lib/dataclasses.py

+12-8
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ def _init_fn(fields, std_fields, kw_only_fields, frozen, has_post_init,
627627
def _repr_fn(fields, globals):
628628
fn = _create_fn('__repr__',
629629
('self',),
630-
['return self.__class__.__qualname__ + f"(' +
630+
['return f"{self.__class__.__qualname__}(' +
631631
', '.join([f"{f.name}={{self.{f.name}!r}}"
632632
for f in fields]) +
633633
')"'],
@@ -1085,13 +1085,17 @@ def _process_class(cls, init, repr, eq, order, unsafe_hash, frozen,
10851085
if eq:
10861086
# Create __eq__ method. There's no need for a __ne__ method,
10871087
# since python will call __eq__ and negate it.
1088-
flds = [f for f in field_list if f.compare]
1089-
self_tuple = _tuple_str('self', flds)
1090-
other_tuple = _tuple_str('other', flds)
1091-
_set_new_attribute(cls, '__eq__',
1092-
_cmp_fn('__eq__', '==',
1093-
self_tuple, other_tuple,
1094-
globals=globals))
1088+
cmp_fields = (field for field in field_list if field.compare)
1089+
terms = [f'self.{field.name}==other.{field.name}' for field in cmp_fields]
1090+
field_comparisons = ' and '.join(terms) or 'True'
1091+
body = [f'if other.__class__ is self.__class__:',
1092+
f' return {field_comparisons}',
1093+
f'return NotImplemented']
1094+
func = _create_fn('__eq__',
1095+
('self', 'other'),
1096+
body,
1097+
globals=globals)
1098+
_set_new_attribute(cls, '__eq__', func)
10951099

10961100
if order:
10971101
# Create and set the ordering methods.

Diff for: Python/fileutils.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ _Py_device_encoding(int fd)
112112
}
113113

114114

115-
static size_t
115+
static int
116116
is_valid_wide_char(wchar_t ch)
117117
{
118118
#ifdef HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION

Diff for: Tools/build/stable_abi.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,8 @@ def main():
684684

685685
if args.all:
686686
run_all_generators = True
687-
args.unixy_check = True
687+
if UNIXY:
688+
args.unixy_check = True
688689

689690
try:
690691
file = args.file.open('rb')

0 commit comments

Comments
 (0)