Skip to content

Commit a1a2925

Browse files
authored
Merge branch 'main' into main
2 parents 11b4352 + 6c982ae commit a1a2925

File tree

13 files changed

+118
-186
lines changed

13 files changed

+118
-186
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,13 @@ jobs:
245245
- true
246246
os:
247247
- ubuntu-24.04
248-
- ubuntu-22.04-arm
248+
- ubuntu-24.04-arm
249249
exclude:
250250
# Do not test BOLT with free-threading, to conserve resources
251251
- bolt: true
252252
free-threading: true
253253
# BOLT currently crashes during instrumentation on aarch64
254-
- os: ubuntu-22.04-arm
254+
- os: ubuntu-24.04-arm
255255
bolt: true
256256
uses: ./.github/workflows/reusable-ubuntu.yml
257257
with:

.github/workflows/jit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
runner: ubuntu-24.04
8787
- target: aarch64-unknown-linux-gnu/gcc
8888
architecture: aarch64
89-
runner: ubuntu-22.04-arm
89+
runner: ubuntu-24.04-arm
9090
steps:
9191
- uses: actions/checkout@v4
9292
with:

.github/workflows/tail-call.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
runner: ubuntu-24.04
6666
- target: aarch64-unknown-linux-gnu/gcc
6767
architecture: aarch64
68-
runner: ubuntu-22.04-arm
68+
runner: ubuntu-24.04-arm
6969
- target: free-threading
7070
architecture: x86_64
7171
runner: ubuntu-24.04

Doc/library/traceback.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,14 @@ Module-Level Functions
115115

116116
.. function:: print_exc(limit=None, file=None, chain=True)
117117

118-
This is a shorthand for ``print_exception(sys.exception(), limit, file,
119-
chain)``.
118+
This is a shorthand for ``print_exception(sys.exception(), limit=limit, file=file,
119+
chain=chain)``.
120120

121121

122122
.. function:: print_last(limit=None, file=None, chain=True)
123123

124-
This is a shorthand for ``print_exception(sys.last_exc, limit, file,
125-
chain)``. In general it will work only after an exception has reached
124+
This is a shorthand for ``print_exception(sys.last_exc, limit=limit, file=file,
125+
chain=chain)``. In general it will work only after an exception has reached
126126
an interactive prompt (see :data:`sys.last_exc`).
127127

128128

Doc/tutorial/introduction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ an odd number of ``\`` characters; see
195195
and workarounds.
196196

197197
String literals can span multiple lines. One way is using triple-quotes:
198-
``"""..."""`` or ``'''...'''``. End of lines are automatically
198+
``"""..."""`` or ``'''...'''``. End-of-line characters are automatically
199199
included in the string, but it's possible to prevent this by adding a ``\`` at
200200
the end of the line. In the following example, the initial newline is not
201201
included::

Lib/asyncio/tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,7 @@ def _unregister_eager_task(task):
11101110
from _asyncio import (_register_task, _register_eager_task,
11111111
_unregister_task, _unregister_eager_task,
11121112
_enter_task, _leave_task, _swap_current_task,
1113-
_scheduled_tasks, _eager_tasks, _current_tasks,
1113+
_scheduled_tasks, _eager_tasks,
11141114
current_task, all_tasks)
11151115
except ImportError:
11161116
pass

Lib/test/test_frame.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,12 @@ def f():
346346
self.assertEqual(x, 2)
347347
self.assertEqual(y, 3)
348348

349+
def test_closure_with_inline_comprehension(self):
350+
lambda: k
351+
k = 1
352+
lst = [locals() for k in [0]]
353+
self.assertEqual(lst[0]['k'], 0)
354+
349355
def test_as_dict(self):
350356
x = 1
351357
y = 2

Lib/test/test_traceback.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,13 @@ def test_print_exception_exc(self):
510510
traceback.print_exception(Exception("projector"), file=output)
511511
self.assertEqual(output.getvalue(), "Exception: projector\n")
512512

513+
def test_print_last(self):
514+
self.assertIsNone(getattr(sys, "last_exc", None))
515+
sys.last_exc = ValueError(42)
516+
output = StringIO()
517+
traceback.print_last(file=output)
518+
self.assertEqual(output.getvalue(), "ValueError: 42\n")
519+
513520
def test_format_exception_exc(self):
514521
e = Exception("projector")
515522
output = traceback.format_exception(e)

Lib/traceback.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,23 +204,23 @@ def _safe_string(value, what, func=str):
204204
# --
205205

206206
def print_exc(limit=None, file=None, chain=True):
207-
"""Shorthand for 'print_exception(sys.exception(), limit, file, chain)'."""
207+
"""Shorthand for 'print_exception(sys.exception(), limit=limit, file=file, chain=chain)'."""
208208
print_exception(sys.exception(), limit=limit, file=file, chain=chain)
209209

210210
def format_exc(limit=None, chain=True):
211211
"""Like print_exc() but return a string."""
212212
return "".join(format_exception(sys.exception(), limit=limit, chain=chain))
213213

214214
def print_last(limit=None, file=None, chain=True):
215-
"""This is a shorthand for 'print_exception(sys.last_exc, limit, file, chain)'."""
215+
"""This is a shorthand for 'print_exception(sys.last_exc, limit=limit, file=file, chain=chain)'."""
216216
if not hasattr(sys, "last_exc") and not hasattr(sys, "last_type"):
217217
raise ValueError("no last exception")
218218

219219
if hasattr(sys, "last_exc"):
220-
print_exception(sys.last_exc, limit, file, chain)
220+
print_exception(sys.last_exc, limit=limit, file=file, chain=chain)
221221
else:
222222
print_exception(sys.last_type, sys.last_value, sys.last_traceback,
223-
limit, file, chain)
223+
limit=limit, file=file, chain=chain)
224224

225225

226226
#
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a crash that occurs when calling :func:`locals` inside an inline comprehension that uses the same local variable as the outer frame scope where the variable is a free or cell var.

0 commit comments

Comments
 (0)