Skip to content

Commit e79ed43

Browse files
committed
Merge branch 'main' into gh-137400-now-with-fewer-crashes
2 parents 468b8fe + 082f370 commit e79ed43

23 files changed

+415
-255
lines changed

Doc/library/time.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ These constants are used as parameters for :func:`clock_getres` and
935935

936936
.. data:: CLOCK_TAI
937937

938-
`International Atomic Time <https://www.nist.gov/pml/time-and-frequency-division/nist-time-frequently-asked-questions-faq#tai>`_
938+
`International Atomic Time <https://www.nist.gov/pml/time-and-frequency-division/how-utcnist-related-coordinated-universal-time-utc-international>`_
939939

940940
The system must have a current leap second table in order for this to give
941941
the correct answer. PTP or NTP software can maintain a leap second table.

Doc/library/warnings.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ Available Functions
458458
lower.one_way(**kw)
459459

460460
This makes the warning refer to both the ``example.lower.one_way()`` and
461-
``package.higher.another_way()`` call sites only from calling code living
461+
``example.higher.another_way()`` call sites only from calling code living
462462
outside of ``example`` package.
463463

464464
*source*, if supplied, is the destroyed object which emitted a

Doc/reference/compound_stmts.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ have ambiguous semantics.
386386

387387
It is not possible to mix :keyword:`except` and :keyword:`!except*`
388388
in the same :keyword:`try`.
389-
:keyword:`break`, :keyword:`continue` and :keyword:`return`
389+
The :keyword:`break`, :keyword:`continue`, and :keyword:`return` statements
390390
cannot appear in an :keyword:`!except*` clause.
391391

392392

Include/internal/pycore_pyatomic_ft_wrappers.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ extern "C" {
111111
_Py_atomic_load_ullong_relaxed(&value)
112112
#define FT_ATOMIC_ADD_SSIZE(value, new_value) \
113113
(void)_Py_atomic_add_ssize(&value, new_value)
114+
#define FT_MUTEX_LOCK(lock) PyMutex_Lock(lock)
115+
#define FT_MUTEX_UNLOCK(lock) PyMutex_Unlock(lock)
114116

115117
#else
116118
#define FT_ATOMIC_LOAD_PTR(value) value
@@ -159,6 +161,8 @@ extern "C" {
159161
#define FT_ATOMIC_LOAD_ULLONG_RELAXED(value) value
160162
#define FT_ATOMIC_STORE_ULLONG_RELAXED(value, new_value) value = new_value
161163
#define FT_ATOMIC_ADD_SSIZE(value, new_value) (void)(value += new_value)
164+
#define FT_MUTEX_LOCK(lock) do {} while (0)
165+
#define FT_MUTEX_UNLOCK(lock) do {} while (0)
162166

163167
#endif
164168

Lib/asyncio/__main__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@ def interrupt(self) -> None:
156156
)
157157
ps.add_argument("pid", type=int, help="Process ID to inspect")
158158
formats = [fmt.value for fmt in TaskTableOutputFormat]
159-
ps.add_argument("--format", choices=formats, default="table")
159+
formats_to_show = [fmt for fmt in formats
160+
if fmt != TaskTableOutputFormat.bsv.value]
161+
ps.add_argument("--format", choices=formats, default="table",
162+
metavar=f"{{{','.join(formats_to_show)}}}")
160163
pstree = subparsers.add_parser(
161164
"pstree", help="Display a tree of all pending tasks in a process"
162165
)

Lib/asyncio/tools.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,9 @@ def _get_awaited_by_tasks(pid: int) -> list:
236236
class TaskTableOutputFormat(StrEnum):
237237
table = auto()
238238
csv = auto()
239+
bsv = auto()
240+
# 🍌SV is not just a format. It's a lifestyle. A philosophy.
241+
# https://www.youtube.com/watch?v=RrsVi1P6n0w
239242

240243

241244
def display_awaited_by_tasks_table(pid, *, format=TaskTableOutputFormat.table):
@@ -273,6 +276,8 @@ def _display_awaited_by_tasks_csv(table, *, format):
273276
"""Print the table in CSV format"""
274277
if format == TaskTableOutputFormat.csv:
275278
delimiter = ','
279+
elif format == TaskTableOutputFormat.bsv:
280+
delimiter = '\N{BANANA}'
276281
else:
277282
raise ValueError(f"Unknown output format: {format}")
278283
csv_writer = csv.writer(sys.stdout, delimiter=delimiter)

Lib/sysconfig/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,13 @@ def _init_non_posix(vars):
412412
vars['EXE'] = '.exe'
413413
vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT
414414
vars['BINDIR'] = os.path.dirname(_safe_realpath(sys.executable))
415-
vars['TZPATH'] = ''
415+
# No standard path exists on Windows for this, but we'll check
416+
# whether someone is imitating a POSIX-like layout
417+
check_tzpath = os.path.join(vars['prefix'], 'share', 'zoneinfo')
418+
if os.path.exists(check_tzpath):
419+
vars['TZPATH'] = check_tzpath
420+
else:
421+
vars['TZPATH'] = ''
416422

417423
#
418424
# public APIs

Lib/test/test_collections.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ def validate_abstract_methods(self, abc, *names):
736736
stubs = methodstubs.copy()
737737
del stubs[name]
738738
C = type('C', (abc,), stubs)
739-
self.assertRaises(TypeError, C, name)
739+
self.assertRaises(TypeError, C)
740740

741741
def validate_isinstance(self, abc, name):
742742
stub = lambda s, *args: 0
@@ -963,7 +963,7 @@ class AnextOnly:
963963
async def __anext__(self):
964964
raise StopAsyncIteration
965965
self.assertNotIsInstance(AnextOnly(), AsyncIterator)
966-
self.validate_abstract_methods(AsyncIterator, '__anext__', '__aiter__')
966+
self.validate_abstract_methods(AsyncIterator, '__anext__')
967967

968968
def test_Iterable(self):
969969
# Check some non-iterables
@@ -1159,7 +1159,7 @@ def test_Iterator(self):
11591159
for x in samples:
11601160
self.assertIsInstance(x, Iterator)
11611161
self.assertIsSubclass(type(x), Iterator)
1162-
self.validate_abstract_methods(Iterator, '__next__', '__iter__')
1162+
self.validate_abstract_methods(Iterator, '__next__')
11631163

11641164
# Issue 10565
11651165
class NextOnly:
@@ -1843,8 +1843,7 @@ def test_Mapping(self):
18431843
for sample in [dict]:
18441844
self.assertIsInstance(sample(), Mapping)
18451845
self.assertIsSubclass(sample, Mapping)
1846-
self.validate_abstract_methods(Mapping, '__contains__', '__iter__', '__len__',
1847-
'__getitem__')
1846+
self.validate_abstract_methods(Mapping, '__iter__', '__len__', '__getitem__')
18481847
class MyMapping(Mapping):
18491848
def __len__(self):
18501849
return 0
@@ -1859,7 +1858,7 @@ def test_MutableMapping(self):
18591858
for sample in [dict]:
18601859
self.assertIsInstance(sample(), MutableMapping)
18611860
self.assertIsSubclass(sample, MutableMapping)
1862-
self.validate_abstract_methods(MutableMapping, '__contains__', '__iter__', '__len__',
1861+
self.validate_abstract_methods(MutableMapping, '__iter__', '__len__',
18631862
'__getitem__', '__setitem__', '__delitem__')
18641863

18651864
def test_MutableMapping_subclass(self):
@@ -1898,8 +1897,7 @@ def test_Sequence(self):
18981897
self.assertIsInstance(memoryview(b""), Sequence)
18991898
self.assertIsSubclass(memoryview, Sequence)
19001899
self.assertIsSubclass(str, Sequence)
1901-
self.validate_abstract_methods(Sequence, '__contains__', '__iter__', '__len__',
1902-
'__getitem__')
1900+
self.validate_abstract_methods(Sequence, '__len__', '__getitem__')
19031901

19041902
def test_Sequence_mixins(self):
19051903
class SequenceSubclass(Sequence):
@@ -1954,8 +1952,8 @@ def test_MutableSequence(self):
19541952
self.assertIsSubclass(sample, MutableSequence)
19551953
self.assertIsSubclass(array.array, MutableSequence)
19561954
self.assertNotIsSubclass(str, MutableSequence)
1957-
self.validate_abstract_methods(MutableSequence, '__contains__', '__iter__',
1958-
'__len__', '__getitem__', '__setitem__', '__delitem__', 'insert')
1955+
self.validate_abstract_methods(MutableSequence, '__len__', '__getitem__',
1956+
'__setitem__', '__delitem__', 'insert')
19591957

19601958
def test_MutableSequence_mixins(self):
19611959
# Test the mixins of MutableSequence by creating a minimal concrete

0 commit comments

Comments
 (0)