Skip to content

Commit 89362f5

Browse files
authored
Merge branch 'main' into fix-taskgroup-eager-refcycle
2 parents 7c966d0 + 145276a commit 89362f5

19 files changed

+208
-170
lines changed

Doc/library/calendar.rst

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,33 @@ interpreted as prescribed by the ISO 8601 standard. Year 0 is 1 BC, year -1 is
3838
itself. This is the job of subclasses.
3939

4040

41-
:class:`Calendar` instances have the following methods:
41+
:class:`Calendar` instances have the following methods and attributes:
42+
43+
.. attribute:: firstweekday
44+
45+
The first weekday as an integer (0--6).
46+
47+
This property can also be set and read using
48+
:meth:`~Calendar.setfirstweekday` and
49+
:meth:`~Calendar.getfirstweekday` respectively.
50+
51+
.. method:: getfirstweekday()
52+
53+
Return an :class:`int` for the current first weekday (0--6).
54+
55+
Identical to reading the :attr:`~Calendar.firstweekday` property.
56+
57+
.. method:: setfirstweekday(firstweekday)
58+
59+
Set the first weekday to *firstweekday*, passed as an :class:`int` (0--6)
60+
61+
Identical to setting the :attr:`~Calendar.firstweekday` property.
4262

4363
.. method:: iterweekdays()
4464

4565
Return an iterator for the week day numbers that will be used for one
4666
week. The first value from the iterator will be the same as the value of
47-
the :attr:`firstweekday` property.
67+
the :attr:`~Calendar.firstweekday` property.
4868

4969

5070
.. method:: itermonthdates(year, month)

Doc/library/ctypes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1812,6 +1812,8 @@ different ways, depending on the type and number of the parameters in the call:
18121812
the COM interface as first argument, in addition to those parameters that
18131813
are specified in the :attr:`!argtypes` tuple.
18141814

1815+
.. availability:: Windows
1816+
18151817

18161818
The optional *paramflags* parameter creates foreign function wrappers with much
18171819
more functionality than the features described above.

Lib/asyncio/timeouts.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import enum
22

33
from types import TracebackType
4-
from typing import final, Optional, Type
54

65
from . import events
76
from . import exceptions
@@ -23,14 +22,13 @@ class _State(enum.Enum):
2322
EXITED = "finished"
2423

2524

26-
@final
2725
class Timeout:
2826
"""Asynchronous context manager for cancelling overdue coroutines.
2927
3028
Use `timeout()` or `timeout_at()` rather than instantiating this class directly.
3129
"""
3230

33-
def __init__(self, when: Optional[float]) -> None:
31+
def __init__(self, when: float | None) -> None:
3432
"""Schedule a timeout that will trigger at a given loop time.
3533
3634
- If `when` is `None`, the timeout will never trigger.
@@ -39,15 +37,15 @@ def __init__(self, when: Optional[float]) -> None:
3937
"""
4038
self._state = _State.CREATED
4139

42-
self._timeout_handler: Optional[events.TimerHandle] = None
43-
self._task: Optional[tasks.Task] = None
40+
self._timeout_handler: events.TimerHandle | None = None
41+
self._task: tasks.Task | None = None
4442
self._when = when
4543

46-
def when(self) -> Optional[float]:
44+
def when(self) -> float | None:
4745
"""Return the current deadline."""
4846
return self._when
4947

50-
def reschedule(self, when: Optional[float]) -> None:
48+
def reschedule(self, when: float | None) -> None:
5149
"""Reschedule the timeout."""
5250
if self._state is not _State.ENTERED:
5351
if self._state is _State.CREATED:
@@ -96,10 +94,10 @@ async def __aenter__(self) -> "Timeout":
9694

9795
async def __aexit__(
9896
self,
99-
exc_type: Optional[Type[BaseException]],
100-
exc_val: Optional[BaseException],
101-
exc_tb: Optional[TracebackType],
102-
) -> Optional[bool]:
97+
exc_type: type[BaseException] | None,
98+
exc_val: BaseException | None,
99+
exc_tb: TracebackType | None,
100+
) -> bool | None:
103101
assert self._state in (_State.ENTERED, _State.EXPIRING)
104102

105103
if self._timeout_handler is not None:
@@ -142,7 +140,7 @@ def _insert_timeout_error(exc_val: BaseException) -> None:
142140
exc_val = exc_val.__context__
143141

144142

145-
def timeout(delay: Optional[float]) -> Timeout:
143+
def timeout(delay: float | None) -> Timeout:
146144
"""Timeout async context manager.
147145
148146
Useful in cases when you want to apply timeout logic around block
@@ -162,7 +160,7 @@ def timeout(delay: Optional[float]) -> Timeout:
162160
return Timeout(loop.time() + delay if delay is not None else None)
163161

164162

165-
def timeout_at(when: Optional[float]) -> Timeout:
163+
def timeout_at(when: float | None) -> Timeout:
166164
"""Schedule the timeout at absolute time.
167165
168166
Like timeout() but argument gives absolute time in the same clock system

Lib/test/test_compiler_codegen.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def test_if_expression(self):
2929
('LOAD_CONST', 0, 1),
3030
('TO_BOOL', 0, 1),
3131
('POP_JUMP_IF_FALSE', false_lbl := self.Label(), 1),
32-
('NOT_TAKEN', None, 1),
3332
('LOAD_SMALL_INT', 42, 1),
3433
('JUMP_NO_INTERRUPT', exit_lbl := self.Label()),
3534
false_lbl,

Lib/test/test_dis.py

Lines changed: 123 additions & 125 deletions
Large diffs are not rendered by default.

Lib/test/test_io.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3933,6 +3933,7 @@ def test_issue35928(self):
39333933
self.assertEqual(res + f.readline(), 'foo\nbar\n')
39343934

39353935
@unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
3936+
@unittest.skipIf(support.is_emscripten, "Would be fixed by emscripten-core/emscripten#23306")
39363937
def test_read_non_blocking(self):
39373938
import os
39383939
r, w = os.pipe()

Lib/test/test_os.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4979,6 +4979,7 @@ def test_unpickable(self):
49794979
self.assertRaises(TypeError, pickle.dumps, scandir_iter, filename)
49804980
scandir_iter.close()
49814981

4982+
@unittest.skipIf(support.is_emscripten, "Fixed by emscripten-core/emscripten#23139, remove when next Emscripten release comes out")
49824983
def check_entry(self, entry, name, is_dir, is_file, is_symlink):
49834984
self.assertIsInstance(entry, os.DirEntry)
49844985
self.assertEqual(entry.name, name)

Lib/test/test_shutil.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,6 +1587,7 @@ def test_copyfile_same_file(self):
15871587
# the path as a directory, but on AIX the trailing slash has no effect
15881588
# and is considered as a file.
15891589
@unittest.skipIf(AIX, 'Not valid on AIX, see gh-92670')
1590+
@unittest.skipIf(support.is_emscripten, 'Fixed by emscripten-core/emscripten#23218, remove when next Emscripten release comes out')
15901591
def test_copyfile_nonexistent_dir(self):
15911592
# Issue 43219
15921593
src_dir = self.mkdtemp()

Lib/test/test_tarfile.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3800,6 +3800,7 @@ def test_absolute_hardlink(self):
38003800
"'parent' is a link to an absolute path")
38013801

38023802
@symlink_test
3803+
@unittest.skipIf(support.is_emscripten, "Fixed by emscripten-core/emscripten#23136, remove when next Emscripten release comes out")
38033804
def test_sly_relative0(self):
38043805
# Inspired by 'relative0' in jwilk/traversal-archives
38053806
with ArchiveMaker() as arc:

Lib/test/test_zipfile/test_core.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
from test.support import script_helper
2323
from test.support import (
2424
findfile, requires_zlib, requires_bz2, requires_lzma,
25-
captured_stdout, captured_stderr, requires_subprocess
25+
captured_stdout, captured_stderr, requires_subprocess,
26+
is_emscripten
2627
)
2728
from test.support.os_helper import (
2829
TESTFN, unlink, rmtree, temp_dir, temp_cwd, fd_count, FakePath
@@ -622,6 +623,7 @@ def test_write_to_readonly(self):
622623
with self.assertRaises(ValueError):
623624
zipfp.open(TESTFN, mode='w')
624625

626+
@unittest.skipIf(is_emscripten, "Fixed by emscripten-core/emscripten#23310")
625627
def test_add_file_before_1980(self):
626628
# Set atime and mtime to 1970-01-01
627629
os.utime(TESTFN, (0, 0))

0 commit comments

Comments
 (0)