Skip to content

Commit 82f1b95

Browse files
authored
Merge branch '3.12' into fix-comp-local-conflict
2 parents 2f1e4aa + 60be65a commit 82f1b95

File tree

17 files changed

+59
-56
lines changed

17 files changed

+59
-56
lines changed

Doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787

8888
# Minimum version of sphinx required
8989
# Keep this version in sync with ``Doc/requirements.txt``.
90-
needs_sphinx = '8.1.3'
90+
needs_sphinx = '8.2.0'
9191

9292
# Create table of contents entries for domain objects (e.g. functions, classes,
9393
# attributes, etc.). Default is True.

Doc/library/typing.rst

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ provides backports of these new features to older versions of Python.
5353
should broadly apply to most Python type checkers. (Some parts may still
5454
be specific to mypy.)
5555

56-
`"Static Typing with Python" <https://typing.readthedocs.io/en/latest/>`_
56+
`"Static Typing with Python" <https://typing.python.org/en/latest/>`_
5757
Type-checker-agnostic documentation written by the community detailing
5858
type system features, useful typing related tools and typing best
5959
practices.
@@ -64,7 +64,7 @@ Specification for the Python Type System
6464
========================================
6565

6666
The canonical, up-to-date specification of the Python type system can be
67-
found at `"Specification for the Python type system" <https://typing.readthedocs.io/en/latest/spec/index.html>`_.
67+
found at `"Specification for the Python type system" <https://typing.python.org/en/latest/spec/index.html>`_.
6868

6969
.. _type-aliases:
7070

@@ -2294,17 +2294,22 @@ types.
22942294
The keyword-argument syntax is deprecated in 3.11 and will be removed
22952295
in 3.13. It may also be unsupported by static type checkers.
22962296

2297-
The functional syntax should also be used when any of the keys are not valid
2298-
:ref:`identifiers <identifiers>`, for example because they are keywords or contain hyphens.
2299-
Example::
2297+
This functional syntax allows defining keys which are not valid
2298+
:ref:`identifiers <identifiers>`, for example because they are
2299+
keywords or contain hyphens, or when key names must not be
2300+
:ref:`mangled <private-name-mangling>` like regular private names::
23002301

23012302
# raises SyntaxError
23022303
class Point2D(TypedDict):
23032304
in: int # 'in' is a keyword
23042305
x-y: int # name with hyphens
23052306

2307+
class Definition(TypedDict):
2308+
__schema: str # mangled to `_Definition__schema`
2309+
23062310
# OK, functional syntax
23072311
Point2D = TypedDict('Point2D', {'in': int, 'x-y': int})
2312+
Definition = TypedDict('Definition', {'__schema': str}) # not mangled
23082313

23092314
By default, all keys must be present in a ``TypedDict``. It is possible to
23102315
mark individual keys as non-required using :data:`NotRequired`::
@@ -2600,7 +2605,7 @@ Functions and decorators
26002605

26012606
.. seealso::
26022607
`Unreachable Code and Exhaustiveness Checking
2603-
<https://typing.readthedocs.io/en/latest/guides/unreachable.html>`__ has more
2608+
<https://typing.python.org/en/latest/guides/unreachable.html>`__ has more
26042609
information about exhaustiveness checking with static typing.
26052610

26062611
.. versionadded:: 3.11

Lib/test/_test_multiprocessing.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -588,12 +588,16 @@ def test_cpu_count(self):
588588
def test_active_children(self):
589589
self.assertEqual(type(self.active_children()), list)
590590

591-
p = self.Process(target=time.sleep, args=(DELTA,))
591+
event = self.Event()
592+
p = self.Process(target=event.wait, args=())
592593
self.assertNotIn(p, self.active_children())
593594

594-
p.daemon = True
595-
p.start()
596-
self.assertIn(p, self.active_children())
595+
try:
596+
p.daemon = True
597+
p.start()
598+
self.assertIn(p, self.active_children())
599+
finally:
600+
event.set()
597601

598602
p.join()
599603
self.assertNotIn(p, self.active_children())

Lib/test/test_asyncio/test_base_events.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,20 +232,25 @@ def test_set_default_executor_error(self):
232232
self.assertIsNone(self.loop._default_executor)
233233

234234
def test_shutdown_default_executor_timeout(self):
235+
event = threading.Event()
236+
235237
class DummyExecutor(concurrent.futures.ThreadPoolExecutor):
236238
def shutdown(self, wait=True, *, cancel_futures=False):
237239
if wait:
238-
time.sleep(0.1)
240+
event.wait()
239241

240242
self.loop._process_events = mock.Mock()
241243
self.loop._write_to_self = mock.Mock()
242244
executor = DummyExecutor()
243245
self.loop.set_default_executor(executor)
244246

245-
with self.assertWarnsRegex(RuntimeWarning,
246-
"The executor did not finishing joining"):
247-
self.loop.run_until_complete(
248-
self.loop.shutdown_default_executor(timeout=0.01))
247+
try:
248+
with self.assertWarnsRegex(RuntimeWarning,
249+
"The executor did not finishing joining"):
250+
self.loop.run_until_complete(
251+
self.loop.shutdown_default_executor(timeout=0.01))
252+
finally:
253+
event.set()
249254

250255
def test_call_soon(self):
251256
def cb():

Lib/test/test_capi/test_long.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,8 @@ def check_long_asintandoverflow(self, func, min_val, max_val):
208208

209209
self.assertEqual(func(min_val - 1), (-1, -1))
210210
self.assertEqual(func(max_val + 1), (-1, +1))
211-
212-
# CRASHES func(1.0)
213-
# CRASHES func(NULL)
211+
self.assertRaises(SystemError, func, None)
212+
self.assertRaises(TypeError, func, 1.0)
214213

215214
def test_long_aslong(self):
216215
# Test PyLong_AsLong() and PyLong_FromLong()

Lib/test/test_subprocess.py

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -268,21 +268,13 @@ def test_check_output_stdin_with_input_arg(self):
268268
self.assertIn('stdin', c.exception.args[0])
269269
self.assertIn('input', c.exception.args[0])
270270

271-
@support.requires_resource('walltime')
272271
def test_check_output_timeout(self):
273272
# check_output() function with timeout arg
274273
with self.assertRaises(subprocess.TimeoutExpired) as c:
275274
output = subprocess.check_output(
276275
[sys.executable, "-c",
277-
"import sys, time\n"
278-
"sys.stdout.write('BDFL')\n"
279-
"sys.stdout.flush()\n"
280-
"time.sleep(3600)"],
281-
# Some heavily loaded buildbots (sparc Debian 3.x) require
282-
# this much time to start and print.
283-
timeout=3)
284-
self.fail("Expected TimeoutExpired.")
285-
self.assertEqual(c.exception.output, b'BDFL')
276+
"import time; time.sleep(3600)"],
277+
timeout=0.1)
286278

287279
def test_call_kwargs(self):
288280
# call() function with keyword args
@@ -1708,20 +1700,11 @@ def test_check_output_stdin_with_input_arg(self):
17081700
self.assertIn('stdin', c.exception.args[0])
17091701
self.assertIn('input', c.exception.args[0])
17101702

1711-
@support.requires_resource('walltime')
17121703
def test_check_output_timeout(self):
17131704
with self.assertRaises(subprocess.TimeoutExpired) as c:
1714-
cp = self.run_python((
1715-
"import sys, time\n"
1716-
"sys.stdout.write('BDFL')\n"
1717-
"sys.stdout.flush()\n"
1718-
"time.sleep(3600)"),
1719-
# Some heavily loaded buildbots (sparc Debian 3.x) require
1720-
# this much time to start and print.
1721-
timeout=3, stdout=subprocess.PIPE)
1722-
self.assertEqual(c.exception.output, b'BDFL')
1723-
# output is aliased to stdout
1724-
self.assertEqual(c.exception.stdout, b'BDFL')
1705+
cp = self.run_python(
1706+
"import time; time.sleep(3600)",
1707+
timeout=0.1, stdout=subprocess.PIPE)
17251708

17261709
def test_run_kwargs(self):
17271710
newenv = os.environ.copy()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Ensure that ``Python.h`` is included before ``stdbool.h`` unless ``pyconfig.h``
2+
is included before or in some platform-specific contexts.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Require Sphinx 8.2.0 or later to build the Python documentation. Patch by
2+
Adam Turner.

Modules/_testcapi/long.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ pylong_aslongandoverflow(PyObject *module, PyObject *arg)
629629
int overflow = UNINITIALIZED_INT;
630630
long value = PyLong_AsLongAndOverflow(arg, &overflow);
631631
if (value == -1 && PyErr_Occurred()) {
632-
assert(overflow == -1);
632+
assert(overflow == 0);
633633
return NULL;
634634
}
635635
return Py_BuildValue("li", value, overflow);
@@ -675,7 +675,7 @@ pylong_aslonglongandoverflow(PyObject *module, PyObject *arg)
675675
int overflow = UNINITIALIZED_INT;
676676
long long value = PyLong_AsLongLongAndOverflow(arg, &overflow);
677677
if (value == -1 && PyErr_Occurred()) {
678-
assert(overflow == -1);
678+
assert(overflow == 0);
679679
return NULL;
680680
}
681681
return Py_BuildValue("Li", value, overflow);

Objects/codeobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#include <stdbool.h>
2-
31
#include "Python.h"
42
#include "opcode.h"
53
#include "structmember.h" // PyMemberDef
@@ -11,6 +9,8 @@
119
#include "pycore_tuple.h" // _PyTuple_ITEMS()
1210
#include "clinic/codeobject.c.h"
1311

12+
#include <stdbool.h>
13+
1414
static PyObject* code_repr(PyCodeObject *co);
1515

1616
static const char *

0 commit comments

Comments
 (0)