Skip to content

Commit bc06764

Browse files
generatedunixname1734921407115435meta-codesync[bot]
authored andcommitted
Import CPython 3.14.5+ stable branch (2026-06-08)
Summary: Imported python/cpython `3.14.5+` from upstream rev [`d56f07c`](https://www.github.com/python/cpython/commit/d56f07c90008170c6eadec226955b3de29e849ea) (committed 2026-06-08 12:58:59+00:00). # Commit Info - Base: (`3.14.5+`) - [`3d45ab2`](https://www.github.com/python/cpython/commit/3d45ab2520dcc1c352d0c2bbb0e1134e5d212645) (commit date: 2026-06-06 21:12:07+00:00) - Imported: (`3.14.5+`) - [`d56f07c`](https://www.github.com/python/cpython/commit/d56f07c90008170c6eadec226955b3de29e849ea) (commit date: 2026-06-08 12:58:59+00:00) # Noteworthy file changes - Low-signal files (2 added) (NEWS.d, docs, .github) Complete list of added/removed files: https://www.internalfb.com/intern/everpaste/?color=0&handle=GM0LtCJsf65nnH0DAPZdGP1kcfkQbr0LAAAz Reviewed By: itamaro Differential Revision: D107932135 fbshipit-source-id: 80093dc34844b6ca26d86a0c7eb97a4574d9d245
1 parent c2cafc1 commit bc06764

12 files changed

Lines changed: 90 additions & 29 deletions

File tree

Doc/c-api/typeobj.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3045,13 +3045,13 @@ Buffer Object Structures
30453045
steps:
30463046

30473047
(1) Check if the request can be met. If not, raise :exc:`BufferError`,
3048-
set :c:expr:`view->obj` to ``NULL`` and return ``-1``.
3048+
set ``view->obj`` to ``NULL`` and return ``-1``.
30493049

30503050
(2) Fill in the requested fields.
30513051

30523052
(3) Increment an internal counter for the number of exports.
30533053

3054-
(4) Set :c:expr:`view->obj` to *exporter* and increment :c:expr:`view->obj`.
3054+
(4) Set ``view->obj`` to *exporter* and increment ``view->obj``.
30553055

30563056
(5) Return ``0``.
30573057

@@ -3077,10 +3077,10 @@ Buffer Object Structures
30773077
schemes can be used:
30783078

30793079
* Re-export: Each member of the tree acts as the exporting object and
3080-
sets :c:expr:`view->obj` to a new reference to itself.
3080+
sets ``view->obj`` to a new reference to itself.
30813081

30823082
* Redirect: The buffer request is redirected to the root object of the
3083-
tree. Here, :c:expr:`view->obj` will be a new reference to the root
3083+
tree. Here, ``view->obj`` will be a new reference to the root
30843084
object.
30853085

30863086
The individual fields of *view* are described in section
@@ -3134,7 +3134,7 @@ Buffer Object Structures
31343134
*view* argument.
31353135

31363136

3137-
This function MUST NOT decrement :c:expr:`view->obj`, since that is
3137+
This function MUST NOT decrement ``view->obj``, since that is
31383138
done automatically in :c:func:`PyBuffer_Release` (this scheme is
31393139
useful for breaking reference cycles).
31403140

Doc/howto/functional.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,7 @@ first calculation. ::
10421042
>>> functools.reduce(operator.concat, [])
10431043
Traceback (most recent call last):
10441044
...
1045-
TypeError: reduce() of empty sequence with no initial value
1045+
TypeError: reduce() of empty iterable with no initial value
10461046
>>> functools.reduce(operator.mul, [1, 2, 3], 1)
10471047
6
10481048
>>> functools.reduce(operator.mul, [], 1)

Doc/library/bisect.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ example uses :py:func:`~bisect.bisect` to look up a letter grade for an exam sco
203203
based on a set of ordered numeric breakpoints: 90 and up is an 'A', 80 to 89 is
204204
a 'B', and so on::
205205

206-
>>> def grade(score)
206+
>>> def grade(score):
207207
... i = bisect([60, 70, 80, 90], score)
208208
... return "FDCBA"[i]
209209
...

Doc/library/operator.rst

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ The mathematical and bitwise operations are the most numerous:
112112
.. function:: and_(a, b)
113113
__and__(a, b)
114114

115-
Return the bitwise and of *a* and *b*.
115+
Return ``a & b``.
116116

117117

118118
.. function:: floordiv(a, b)
@@ -136,13 +136,13 @@ The mathematical and bitwise operations are the most numerous:
136136
__inv__(obj)
137137
__invert__(obj)
138138

139-
Return the bitwise inverse of the number *obj*. This is equivalent to ``~obj``.
139+
Return ``~obj``.
140140

141141

142142
.. function:: lshift(a, b)
143143
__lshift__(a, b)
144144

145-
Return *a* shifted left by *b*.
145+
Return ``a << b``.
146146

147147

148148
.. function:: mod(a, b)
@@ -154,7 +154,7 @@ The mathematical and bitwise operations are the most numerous:
154154
.. function:: mul(a, b)
155155
__mul__(a, b)
156156

157-
Return ``a * b``, for *a* and *b* numbers.
157+
Return ``a * b``.
158158

159159

160160
.. function:: matmul(a, b)
@@ -174,25 +174,25 @@ The mathematical and bitwise operations are the most numerous:
174174
.. function:: or_(a, b)
175175
__or__(a, b)
176176

177-
Return the bitwise or of *a* and *b*.
177+
Return ``a | b``.
178178

179179

180180
.. function:: pos(obj)
181181
__pos__(obj)
182182

183-
Return *obj* positive (``+obj``).
183+
Return ``+obj``.
184184

185185

186186
.. function:: pow(a, b)
187187
__pow__(a, b)
188188

189-
Return ``a ** b``, for *a* and *b* numbers.
189+
Return ``a ** b``.
190190

191191

192192
.. function:: rshift(a, b)
193193
__rshift__(a, b)
194194

195-
Return *a* shifted right by *b*.
195+
Return ``a >> b``.
196196

197197

198198
.. function:: sub(a, b)
@@ -211,7 +211,7 @@ The mathematical and bitwise operations are the most numerous:
211211
.. function:: xor(a, b)
212212
__xor__(a, b)
213213

214-
Return the bitwise exclusive or of *a* and *b*.
214+
Return ``a ^ b``.
215215

216216

217217
Operations which work with sequences (some of them with mappings too) include:
@@ -405,13 +405,18 @@ Python syntax and the functions in the :mod:`!operator` module.
405405
+-----------------------+-------------------------+---------------------------------------+
406406
| Division | ``a // b`` | ``floordiv(a, b)`` |
407407
+-----------------------+-------------------------+---------------------------------------+
408-
| Bitwise And | ``a & b`` | ``and_(a, b)`` |
408+
| Bitwise And, or | ``a & b`` | ``and_(a, b)`` |
409+
| Intersection | | |
409410
+-----------------------+-------------------------+---------------------------------------+
410-
| Bitwise Exclusive Or | ``a ^ b`` | ``xor(a, b)`` |
411+
| Bitwise Exclusive Or, | ``a ^ b`` | ``xor(a, b)`` |
412+
| or Symmetric | | |
413+
| Difference | | |
411414
+-----------------------+-------------------------+---------------------------------------+
412-
| Bitwise Inversion | ``~ a`` | ``invert(a)`` |
415+
| Bitwise Inversion, or | ``~ a`` | ``invert(a)`` |
416+
| Complement | | |
413417
+-----------------------+-------------------------+---------------------------------------+
414-
| Bitwise Or | ``a | b`` | ``or_(a, b)`` |
418+
| Bitwise Or, or | ``a | b`` | ``or_(a, b)`` |
419+
| Union | | |
415420
+-----------------------+-------------------------+---------------------------------------+
416421
| Exponentiation | ``a ** b`` | ``pow(a, b)`` |
417422
+-----------------------+-------------------------+---------------------------------------+

Doc/library/stdtypes.rst

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2174,9 +2174,25 @@ expression support in the :mod:`re` module).
21742174
character, ``False`` otherwise. Digits include decimal characters and digits that need
21752175
special handling, such as the compatibility superscript digits.
21762176
This covers digits which cannot be used to form numbers in base 10,
2177-
like the Kharosthi numbers. Formally, a digit is a character that has the
2177+
like the `Kharosthi numbers <https://en.wikipedia.org/wiki/Kharosthi#Numerals>`__.
2178+
Formally, a digit is a character that has the
21782179
property value Numeric_Type=Digit or Numeric_Type=Decimal.
21792180

2181+
For example:
2182+
2183+
.. doctest::
2184+
2185+
>>> '0123456789'.isdigit()
2186+
True
2187+
>>> '٠١٢٣٤٥٦٧٨٩'.isdigit() # Arabic-Indic digits zero to nine
2188+
True
2189+
>>> ''.isdigit() # Vulgar fraction one fifth
2190+
False
2191+
>>> '²'.isdecimal(), '²'.isdigit(), '²'.isnumeric()
2192+
(False, True, True)
2193+
2194+
See also :meth:`isdecimal` and :meth:`isnumeric`.
2195+
21802196

21812197
.. method:: str.isidentifier()
21822198

@@ -2217,15 +2233,14 @@ expression support in the :mod:`re` module).
22172233

22182234
>>> '0123456789'.isnumeric()
22192235
True
2220-
>>> '٠١٢٣٤٥٦٧٨٩'.isnumeric() # Arabic-indic digit zero to nine
2236+
>>> '٠١٢٣٤٥٦٧٨٩'.isnumeric() # Arabic-Indic digits zero to nine
22212237
True
22222238
>>> ''.isnumeric() # Vulgar fraction one fifth
22232239
True
22242240
>>> '²'.isdecimal(), '²'.isdigit(), '²'.isnumeric()
22252241
(False, True, True)
22262242

2227-
See also :meth:`isdecimal` and :meth:`isdigit`. Numeric characters are
2228-
a superset of decimal numbers.
2243+
See also :meth:`isdecimal` and :meth:`isdigit`.
22292244

22302245

22312246
.. method:: str.isprintable()

Doc/tools/.nitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Doc/c-api/init_config.rst
88
Doc/c-api/intro.rst
99
Doc/c-api/module.rst
1010
Doc/c-api/stable.rst
11-
Doc/c-api/typeobj.rst
1211
Doc/library/ast.rst
1312
Doc/library/asyncio-extending.rst
1413
Doc/library/email.charset.rst

Lib/test/test_bz2.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,21 @@ def test_failure(self):
10321032
# Previously, a second call could crash due to internal inconsistency
10331033
self.assertRaises(Exception, bzd.decompress, self.BAD_DATA * 30)
10341034

1035+
def test_decompress_after_data_error(self):
1036+
data = bytes.fromhex(
1037+
"425a6839314159265359000000000000007fffff000000000000000000000000"
1038+
"00000000000000000000000000000000000000e0370000000000000000000000"
1039+
"000000000000000000000000000000000000000000000000000083f3"
1040+
)
1041+
bzd = BZ2Decompressor()
1042+
with self.assertRaisesRegex(OSError, "Invalid data stream"):
1043+
bzd.decompress(data)
1044+
# Previously, a second call could crash due to internal inconsistency
1045+
self.assertFalse(bzd.needs_input)
1046+
self.assertFalse(bzd.eof)
1047+
with self.assertRaisesRegex(ValueError, "previous error"):
1048+
bzd.decompress(b'\x00' * 18)
1049+
10351050
@support.refcount_test
10361051
def test_refleaks_in___init__(self):
10371052
gettotalrefcount = support.get_attribute(sys, 'gettotalrefcount')

Lib/test/test_xmlrpc.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,17 @@ def test_dump_encoding(self):
208208
self.assertEqual(xmlrpclib.loads(strg)[0][0], value)
209209
self.assertEqual(xmlrpclib.loads(strg)[1], methodname)
210210

211+
def test_dump_escape_methodname(self):
212+
payload = 'foo</methodName><injected attr="evil"/><methodName>bar'
213+
s = xmlrpclib.dumps((), methodname=payload)
214+
self.assertIn(
215+
'<methodName>foo&lt;/methodName&gt;&lt;injected attr="evil"/&gt;'
216+
'&lt;methodName&gt;bar</methodName>', s
217+
)
218+
self.assertNotIn('<injected attr="evil"/>', s)
219+
load, m = xmlrpclib.loads(s)
220+
self.assertEqual(m, payload)
221+
211222
def test_dump_bytes(self):
212223
sample = b"my dog has fleas"
213224
self.assertEqual(sample, xmlrpclib.Binary(sample))

Lib/xmlrpc/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ def dumps(params, methodname=None, methodresponse=None, encoding=None,
965965
data = (
966966
xmlheader,
967967
"<methodCall>\n"
968-
"<methodName>", methodname, "</methodName>\n",
968+
"<methodName>", escape(methodname), "</methodName>\n",
969969
data,
970970
"</methodCall>\n"
971971
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix XML injection vulnerability in :func:`xmlrpc.client.dumps` where the ``methodname`` was not being escaped before interpolation into the XML body.

0 commit comments

Comments
 (0)