Skip to content

Commit 44db781

Browse files
Merge branch 'main' into fix-issue-137818
2 parents 0c74847 + 5c6937a commit 44db781

Some content is hidden

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

52 files changed

+1511
-816
lines changed

.devcontainer/devcontainer.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
"dnf",
66
"install",
77
"-y",
8-
"which",
9-
"zsh",
10-
"fish",
118
// For umask fix below.
129
"/usr/bin/setfacl"
1310
],

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ jobs:
130130
- name: Build CPython
131131
run: |
132132
make -j4 regen-all
133-
make regen-stdlib-module-names regen-sbom regen-unicodedata
133+
make regen-stdlib-module-names regen-sbom
134134
- name: Check for changes
135135
run: |
136136
git add -u

Doc/deprecations/pending-removal-in-3.15.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,6 @@ Pending removal in Python 3.15
107107

108108
* :mod:`zipimport`:
109109

110-
* :meth:`~zipimport.zipimporter.load_module` has been deprecated since
110+
* :meth:`!zipimport.zipimporter.load_module` has been deprecated since
111111
Python 3.10. Use :meth:`~zipimport.zipimporter.exec_module` instead.
112-
(Contributed by Jiahao Li in :gh:`125746`.)
112+
(:gh:`125746`.)

Doc/library/exceptions.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,9 @@ The following exceptions are used as warning categories; see the
897897

898898
Base class for warnings about dubious syntax.
899899

900+
This warning is typically emitted when compiling Python source code, and usually won't be reported
901+
when running already compiled code.
902+
900903

901904
.. exception:: RuntimeWarning
902905

Doc/library/shutil.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ In the final archive, :file:`please_add.txt` should be included, but
860860
... root_dir='tmp/root',
861861
... base_dir='structure/content',
862862
... )
863-
'/Users/tarek/my_archive.tar'
863+
'/Users/tarek/myarchive.tar'
864864

865865
Listing the files in the resulting archive gives us:
866866

Doc/library/warnings.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ The following warnings category classes are currently defined:
8080
| | unless triggered by code in ``__main__``). |
8181
+----------------------------------+-----------------------------------------------+
8282
| :exc:`SyntaxWarning` | Base category for warnings about dubious |
83-
| | syntactic features. |
83+
| | syntactic features (typically emitted when |
84+
| | compiling Python source code, and hence |
85+
| | may not be suppressed by runtime filters) |
8486
+----------------------------------+-----------------------------------------------+
8587
| :exc:`RuntimeWarning` | Base category for warnings about dubious |
8688
| | runtime features. |

Doc/library/zipimport.rst

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,6 @@ zipimporter Objects
142142
:exc:`ZipImportError` if the module couldn't be found.
143143

144144

145-
.. method:: load_module(fullname)
146-
147-
Load the module specified by *fullname*. *fullname* must be the fully
148-
qualified (dotted) module name. Returns the imported module on success,
149-
raises :exc:`ZipImportError` on failure.
150-
151-
.. deprecated-removed:: 3.10 3.15
152-
153-
Use :meth:`exec_module` instead.
154-
155-
156145
.. method:: invalidate_caches()
157146

158147
Clear out the internal cache of information about files found within

Doc/whatsnew/3.15.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,14 @@ wave
611611
(Contributed by Bénédikt Tran in :gh:`133873`.)
612612

613613

614+
zipimport
615+
---------
616+
617+
* Remove deprecated :meth:`!zipimport.zipimporter.load_module`.
618+
Use :meth:`zipimport.zipimporter.exec_module` instead.
619+
(Contributed by Jiahao Li in :gh:`133656`.)
620+
621+
614622
Porting to Python 3.15
615623
======================
616624

Lib/asyncio/__main__.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import argparse
22
import ast
33
import asyncio
4+
import asyncio.tools
45
import concurrent.futures
56
import contextvars
67
import inspect
@@ -10,9 +11,6 @@
1011
import threading
1112
import types
1213
import warnings
13-
from asyncio.tools import (TaskTableOutputFormat,
14-
display_awaited_by_tasks_table,
15-
display_awaited_by_tasks_tree)
1614

1715
from _colorize import get_theme
1816
from _pyrepl.console import InteractiveColoredConsole
@@ -155,22 +153,17 @@ def interrupt(self) -> None:
155153
"ps", help="Display a table of all pending tasks in a process"
156154
)
157155
ps.add_argument("pid", type=int, help="Process ID to inspect")
158-
formats = [fmt.value for fmt in TaskTableOutputFormat]
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)}}}")
163156
pstree = subparsers.add_parser(
164157
"pstree", help="Display a tree of all pending tasks in a process"
165158
)
166159
pstree.add_argument("pid", type=int, help="Process ID to inspect")
167160
args = parser.parse_args()
168161
match args.command:
169162
case "ps":
170-
display_awaited_by_tasks_table(args.pid, format=args.format)
163+
asyncio.tools.display_awaited_by_tasks_table(args.pid)
171164
sys.exit(0)
172165
case "pstree":
173-
display_awaited_by_tasks_tree(args.pid)
166+
asyncio.tools.display_awaited_by_tasks_tree(args.pid)
174167
sys.exit(0)
175168
case None:
176169
pass # continue to the interactive shell

Lib/asyncio/tools.py

Lines changed: 9 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
"""Tools to analyze tasks running in asyncio programs."""
22

3-
from collections import defaultdict
4-
import csv
3+
from collections import defaultdict, namedtuple
54
from itertools import count
6-
from enum import Enum, StrEnum, auto
5+
from enum import Enum
76
import sys
87
from _remote_debugging import RemoteUnwinder, FrameInfo
98

@@ -233,56 +232,18 @@ def _get_awaited_by_tasks(pid: int) -> list:
233232
sys.exit(1)
234233

235234

236-
class TaskTableOutputFormat(StrEnum):
237-
table = auto()
238-
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
242-
243-
244-
def display_awaited_by_tasks_table(pid, *, format=TaskTableOutputFormat.table):
235+
def display_awaited_by_tasks_table(pid: int) -> None:
245236
"""Build and print a table of all pending tasks under `pid`."""
246237

247238
tasks = _get_awaited_by_tasks(pid)
248239
table = build_task_table(tasks)
249-
format = TaskTableOutputFormat(format)
250-
if format == TaskTableOutputFormat.table:
251-
_display_awaited_by_tasks_table(table)
252-
else:
253-
_display_awaited_by_tasks_csv(table, format=format)
254-
255-
256-
_row_header = ('tid', 'task id', 'task name', 'coroutine stack',
257-
'awaiter chain', 'awaiter name', 'awaiter id')
258-
259-
260-
def _display_awaited_by_tasks_table(table):
261-
"""Print the table in a simple tabular format."""
262-
print(_fmt_table_row(*_row_header))
263-
print('-' * 180)
240+
# Print the table in a simple tabular format
241+
print(
242+
f"{'tid':<10} {'task id':<20} {'task name':<20} {'coroutine stack':<50} {'awaiter chain':<50} {'awaiter name':<15} {'awaiter id':<15}"
243+
)
244+
print("-" * 180)
264245
for row in table:
265-
print(_fmt_table_row(*row))
266-
267-
268-
def _fmt_table_row(tid, task_id, task_name, coro_stack,
269-
awaiter_chain, awaiter_name, awaiter_id):
270-
# Format a single row for the table format
271-
return (f'{tid:<10} {task_id:<20} {task_name:<20} {coro_stack:<50} '
272-
f'{awaiter_chain:<50} {awaiter_name:<15} {awaiter_id:<15}')
273-
274-
275-
def _display_awaited_by_tasks_csv(table, *, format):
276-
"""Print the table in CSV format"""
277-
if format == TaskTableOutputFormat.csv:
278-
delimiter = ','
279-
elif format == TaskTableOutputFormat.bsv:
280-
delimiter = '\N{BANANA}'
281-
else:
282-
raise ValueError(f"Unknown output format: {format}")
283-
csv_writer = csv.writer(sys.stdout, delimiter=delimiter)
284-
csv_writer.writerow(_row_header)
285-
csv_writer.writerows(table)
246+
print(f"{row[0]:<10} {row[1]:<20} {row[2]:<20} {row[3]:<50} {row[4]:<50} {row[5]:<15} {row[6]:<15}")
286247

287248

288249
def display_awaited_by_tasks_tree(pid: int) -> None:

0 commit comments

Comments
 (0)