Skip to content

Commit da2a0ad

Browse files
committed
Merge 'origin/main' into pythongh-127266-type-slots-ts
2 parents 7db281c + b5bf8c8 commit da2a0ad

Some content is hidden

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

59 files changed

+1747
-855
lines changed

.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Modules/Setup* @erlend-aasland
3030
Objects/set* @rhettinger
3131
Objects/dict* @methane @markshannon
3232
Objects/typevarobject.c @JelleZijlstra
33+
Objects/unionobject.c @JelleZijlstra
3334
Objects/type* @markshannon
3435
Objects/codeobject.c @markshannon
3536
Objects/frameobject.c @markshannon

.github/zizmor.yml

+4
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ rules:
44
dangerous-triggers:
55
ignore:
66
- documentation-links.yml
7+
unpinned-uses:
8+
config:
9+
policies:
10+
"*": ref-pin

.pre-commit-config.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.11.4
3+
rev: v0.11.6
44
hooks:
55
- id: ruff
66
name: Run Ruff (lint) on Doc/
@@ -24,7 +24,7 @@ repos:
2424
files: ^Doc/
2525

2626
- repo: https://github.com/psf/black-pre-commit-mirror
27-
rev: 24.10.0
27+
rev: 25.1.0
2828
hooks:
2929
- id: black
3030
name: Run Black on Tools/build/check_warnings.py
@@ -49,7 +49,7 @@ repos:
4949
types_or: [c, inc, python, rst]
5050

5151
- repo: https://github.com/python-jsonschema/check-jsonschema
52-
rev: 0.31.0
52+
rev: 0.33.0
5353
hooks:
5454
- id: check-dependabot
5555
- id: check-github-workflows
@@ -61,7 +61,7 @@ repos:
6161
- id: actionlint
6262

6363
- repo: https://github.com/woodruffw/zizmor-pre-commit
64-
rev: v1.1.1
64+
rev: v1.6.0
6565
hooks:
6666
- id: zizmor
6767

Doc/c-api/complex.rst

-54
Original file line numberDiff line numberDiff line change
@@ -44,36 +44,12 @@ pointers. This is consistent throughout the API.
4444
representation.
4545
4646
47-
.. c:function:: Py_complex _Py_cr_sum(Py_complex left, double right)
48-
49-
Return the sum of a complex number and a real number, using the C :c:type:`Py_complex`
50-
representation.
51-
52-
.. versionadded:: 3.14
53-
54-
5547
.. c:function:: Py_complex _Py_c_diff(Py_complex left, Py_complex right)
5648
5749
Return the difference between two complex numbers, using the C
5850
:c:type:`Py_complex` representation.
5951
6052
61-
.. c:function:: Py_complex _Py_cr_diff(Py_complex left, double right)
62-
63-
Return the difference between a complex number and a real number, using the C
64-
:c:type:`Py_complex` representation.
65-
66-
.. versionadded:: 3.14
67-
68-
69-
.. c:function:: Py_complex _Py_rc_diff(double left, Py_complex right)
70-
71-
Return the difference between a real number and a complex number, using the C
72-
:c:type:`Py_complex` representation.
73-
74-
.. versionadded:: 3.14
75-
76-
7753
.. c:function:: Py_complex _Py_c_neg(Py_complex num)
7854
7955
Return the negation of the complex number *num*, using the C
@@ -86,14 +62,6 @@ pointers. This is consistent throughout the API.
8662
representation.
8763
8864
89-
.. c:function:: Py_complex _Py_cr_prod(Py_complex left, double right)
90-
91-
Return the product of a complex number and a real number, using the C
92-
:c:type:`Py_complex` representation.
93-
94-
.. versionadded:: 3.14
95-
96-
9765
.. c:function:: Py_complex _Py_c_quot(Py_complex dividend, Py_complex divisor)
9866
9967
Return the quotient of two complex numbers, using the C :c:type:`Py_complex`
@@ -103,28 +71,6 @@ pointers. This is consistent throughout the API.
10371
:c:data:`errno` to :c:macro:`!EDOM`.
10472
10573
106-
.. c:function:: Py_complex _Py_cr_quot(Py_complex dividend, double divisor)
107-
108-
Return the quotient of a complex number and a real number, using the C
109-
:c:type:`Py_complex` representation.
110-
111-
If *divisor* is zero, this method returns zero and sets
112-
:c:data:`errno` to :c:macro:`!EDOM`.
113-
114-
.. versionadded:: 3.14
115-
116-
117-
.. c:function:: Py_complex _Py_rc_quot(double dividend, Py_complex divisor)
118-
119-
Return the quotient of a real number and a complex number, using the C
120-
:c:type:`Py_complex` representation.
121-
122-
If *divisor* is zero, this method returns zero and sets
123-
:c:data:`errno` to :c:macro:`!EDOM`.
124-
125-
.. versionadded:: 3.14
126-
127-
12874
.. c:function:: Py_complex _Py_c_pow(Py_complex num, Py_complex exp)
12975
13076
Return the exponentiation of *num* by *exp*, using the C :c:type:`Py_complex`

Doc/c-api/unicode.rst

+26
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,21 @@ APIs:
674674
.. versionadded:: 3.3
675675
676676
677+
.. c:function:: int PyUnicode_Resize(PyObject **unicode, Py_ssize_t length);
678+
679+
Resize a Unicode object *\*unicode* to the new *length* in code points.
680+
681+
Try to resize the string in place (which is usually faster than allocating
682+
a new string and copying characters), or create a new string.
683+
684+
*\*unicode* is modified to point to the new (resized) object and ``0`` is
685+
returned on success. Otherwise, ``-1`` is returned and an exception is set,
686+
and *\*unicode* is left untouched.
687+
688+
The function doesn't check string content, the result may not be a
689+
string in canonical representation.
690+
691+
677692
.. c:function:: Py_ssize_t PyUnicode_Fill(PyObject *unicode, Py_ssize_t start, \
678693
Py_ssize_t length, Py_UCS4 fill_char)
679694
@@ -1011,6 +1026,17 @@ generic ones are documented for simplicity.
10111026
Generic Codecs
10121027
""""""""""""""
10131028
1029+
The following macro is provided:
1030+
1031+
1032+
.. c:macro:: Py_UNICODE_REPLACEMENT_CHARACTER
1033+
1034+
The Unicode code point ``U+FFFD`` (replacement character).
1035+
1036+
This Unicode character is used as the replacement character during
1037+
decoding if the *errors* argument is set to "replace".
1038+
1039+
10141040
These are the generic codec APIs:
10151041
10161042

Doc/data/refcounts.dat

+4
Original file line numberDiff line numberDiff line change
@@ -2794,6 +2794,10 @@ PyUnicode_CopyCharacters:PyObject*:from:0:
27942794
PyUnicode_CopyCharacters:Py_ssize_t:from_start::
27952795
PyUnicode_CopyCharacters:Py_ssize_t:how_many::
27962796

2797+
PyUnicode_Resize:int:::
2798+
PyUnicode_Resize:PyObject**:unicode:0:
2799+
PyUnicode_Resize:Py_ssize_t:length::
2800+
27972801
PyUnicode_Fill:Py_ssize_t:::
27982802
PyUnicode_Fill:PyObject*:unicode:0:
27992803
PyUnicode_Fill:Py_ssize_t:start::

Doc/library/socket.rst

+50-3
Original file line numberDiff line numberDiff line change
@@ -677,15 +677,62 @@ Constants
677677
These constants describe the Bluetooth address type when binding or
678678
connecting a :const:`BTPROTO_L2CAP` socket.
679679

680+
.. availability:: Linux, FreeBSD
681+
680682
.. versionadded:: 3.14
681683

684+
.. data:: SOL_RFCOMM
685+
SOL_L2CAP
686+
SOL_HCI
687+
SOL_SCO
688+
SOL_BLUETOOTH
689+
690+
Used in the level argument to the :meth:`~socket.setsockopt` and
691+
:meth:`~socket.getsockopt` methods of Bluetooth socket objects.
692+
693+
:const:`SOL_BLUETOOTH` is only available on Linux. Other constants
694+
are available if the corresponding protocol is supported.
695+
696+
.. data:: SO_L2CAP_*
697+
L2CAP_LM
698+
L2CAP_LM_*
699+
SO_RFCOMM_*
700+
RFCOMM_LM_*
701+
SO_SCO_*
702+
SO_BTH_*
703+
BT_*
704+
705+
Used in the option name and value argument to the :meth:`~socket.setsockopt`
706+
and :meth:`~socket.getsockopt` methods of Bluetooth socket objects.
707+
708+
:const:`!BT_*` and :const:`L2CAP_LM` are only available on Linux.
709+
:const:`!SO_BTH_*` are only available on Windows.
710+
Other constants may be available on Linux and various BSD platforms.
711+
712+
.. versionadded:: next
713+
682714
.. data:: HCI_FILTER
683715
HCI_TIME_STAMP
684716
HCI_DATA_DIR
717+
SO_HCI_EVT_FILTER
718+
SO_HCI_PKT_FILTER
685719

686-
For use with :const:`BTPROTO_HCI`. :const:`!HCI_FILTER` is only
687-
available on Linux and FreeBSD. :const:`!HCI_TIME_STAMP` and
688-
:const:`!HCI_DATA_DIR` are only available on Linux.
720+
Option names for use with :const:`BTPROTO_HCI`.
721+
Availability and format of the option values depend on platform.
722+
723+
.. versionchanged:: next
724+
Added :const:`!SO_HCI_EVT_FILTER` and :const:`!SO_HCI_PKT_FILTER`
725+
on NetBSD and DragonFly BSD.
726+
Added :const:`!HCI_DATA_DIR` on FreeBSD, NetBSD and DragonFly BSD.
727+
728+
.. data:: HCI_DEV_NONE
729+
730+
The ``device_id`` value used to create an HCI socket that isn't specific
731+
to a single Bluetooth adapter.
732+
733+
.. availability:: Linux
734+
735+
.. versionadded:: next
689736

690737
.. data:: HCI_CHANNEL_RAW
691738
HCI_CHANNEL_USER

Doc/whatsnew/3.14.rst

+33
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,13 @@ logging.handlers
860860
(Contributed by Charles Machalow in :gh:`132106`.)
861861

862862

863+
math
864+
----
865+
866+
* Added more detailed error messages for domain errors in the module.
867+
(Contributed by by Charlie Zhao and Sergey B Kirpichev in :gh:`101410`.)
868+
869+
863870
mimetypes
864871
---------
865872

@@ -1081,6 +1088,32 @@ pydoc
10811088
(Contributed by Jelle Zijlstra in :gh:`101552`.)
10821089

10831090

1091+
socket
1092+
------
1093+
1094+
* Improve and fix support for Bluetooth sockets.
1095+
1096+
* Fix support of Bluetooth sockets on NetBSD and DragonFly BSD.
1097+
(Contributed by Serhiy Storchaka in :gh:`132429`.)
1098+
* Fix support for :const:`~socket.BTPROTO_HCI` on FreeBSD.
1099+
(Contributed by Victor Stinner in :gh:`111178`.)
1100+
* Add support for :const:`~socket.BTPROTO_SCO` on FreeBSD.
1101+
(Contributed by Serhiy Storchaka in :gh:`85302`.)
1102+
* Add support for *cid* and *bdaddr_type* in the address for
1103+
:const:`~socket.BTPROTO_L2CAP` on FreeBSD.
1104+
(Contributed by Serhiy Storchaka in :gh:`132429`.)
1105+
* Add support for *channel* in the address for
1106+
:const:`~socket.BTPROTO_HCI` on Linux.
1107+
(Contributed by Serhiy Storchaka in :gh:`70145`.)
1108+
* Accept an integer as the address for
1109+
:const:`~socket.BTPROTO_HCI` on Linux
1110+
(Contributed by Serhiy Storchaka in :gh:`132099`.)
1111+
* Return *cid* in :meth:`~socket.socket.getsockname` for
1112+
:const:`~socket.BTPROTO_L2CAP`.
1113+
(Contributed by Serhiy Storchaka in :gh:`132429`.)
1114+
* Add many new constants.
1115+
(Contributed by Serhiy Storchaka in :gh:`132734`.)
1116+
10841117
ssl
10851118
---
10861119

Grammar/python.gram

+9-3
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,18 @@ func_type[mod_ty]: '(' a=[type_expressions] ')' '->' b=expression NEWLINE* ENDMA
9494
# GENERAL STATEMENTS
9595
# ==================
9696

97-
statements[asdl_stmt_seq*]: a=statement+ { (asdl_stmt_seq*)_PyPegen_seq_flatten(p, a) }
97+
statements[asdl_stmt_seq*]: a=statement+ { _PyPegen_register_stmts(p, (asdl_stmt_seq*)_PyPegen_seq_flatten(p, a)) }
9898

99-
statement[asdl_stmt_seq*]: a=compound_stmt { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) } | a[asdl_stmt_seq*]=simple_stmts { a }
99+
statement[asdl_stmt_seq*]:
100+
| a=compound_stmt { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) }
101+
| a[asdl_stmt_seq*]=simple_stmts { a }
102+
103+
single_compound_stmt[asdl_stmt_seq*]:
104+
| a=compound_stmt {
105+
_PyPegen_register_stmts(p, (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a)) }
100106

101107
statement_newline[asdl_stmt_seq*]:
102-
| a=compound_stmt NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) }
108+
| a=single_compound_stmt NEWLINE { a }
103109
| simple_stmts
104110
| NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, CHECK(stmt_ty, _PyAST_Pass(EXTRA))) }
105111
| ENDMARKER { _PyPegen_interactive_exit(p) }

Include/cpython/complexobject.h

-6
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,10 @@ typedef struct {
99

1010
// Operations on complex numbers.
1111
PyAPI_FUNC(Py_complex) _Py_c_sum(Py_complex, Py_complex);
12-
PyAPI_FUNC(Py_complex) _Py_cr_sum(Py_complex, double);
1312
PyAPI_FUNC(Py_complex) _Py_c_diff(Py_complex, Py_complex);
14-
PyAPI_FUNC(Py_complex) _Py_cr_diff(Py_complex, double);
15-
PyAPI_FUNC(Py_complex) _Py_rc_diff(double, Py_complex);
1613
PyAPI_FUNC(Py_complex) _Py_c_neg(Py_complex);
1714
PyAPI_FUNC(Py_complex) _Py_c_prod(Py_complex, Py_complex);
18-
PyAPI_FUNC(Py_complex) _Py_cr_prod(Py_complex, double);
1915
PyAPI_FUNC(Py_complex) _Py_c_quot(Py_complex, Py_complex);
20-
PyAPI_FUNC(Py_complex) _Py_cr_quot(Py_complex, double);
21-
PyAPI_FUNC(Py_complex) _Py_rc_quot(double, Py_complex);
2216
PyAPI_FUNC(Py_complex) _Py_c_pow(Py_complex, Py_complex);
2317
PyAPI_FUNC(double) _Py_c_abs(Py_complex);
2418

Include/cpython/pyerrors.h

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ typedef struct {
3030
PyObject *end_offset;
3131
PyObject *text;
3232
PyObject *print_file_and_line;
33+
PyObject *metadata;
3334
} PySyntaxErrorObject;
3435

3536
typedef struct {

Include/internal/pycore_complexobject.h

+9
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ extern int _PyComplex_FormatAdvancedWriter(
1919
Py_ssize_t start,
2020
Py_ssize_t end);
2121

22+
// Operations on complex numbers.
23+
PyAPI_FUNC(Py_complex) _Py_cr_sum(Py_complex, double);
24+
PyAPI_FUNC(Py_complex) _Py_cr_diff(Py_complex, double);
25+
PyAPI_FUNC(Py_complex) _Py_rc_diff(double, Py_complex);
26+
PyAPI_FUNC(Py_complex) _Py_cr_prod(Py_complex, double);
27+
PyAPI_FUNC(Py_complex) _Py_cr_quot(Py_complex, double);
28+
PyAPI_FUNC(Py_complex) _Py_rc_quot(double, Py_complex);
29+
30+
2231
#ifdef __cplusplus
2332
}
2433
#endif

Include/internal/pycore_opcode_metadata.h

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)