Skip to content

Commit 2f46caf

Browse files
committed
Address review comments
1 parent f1cb1e3 commit 2f46caf

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Lib/test/test_traceback.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4501,8 +4501,8 @@ def __getattribute__(self, x):
45014501
print(x)
45024502
print(qq)
45034503

4504-
for name, instance in (("a", A()), ("b", B())):
4505-
with self.subTest(name=name):
4504+
for instance in (A(), B()):
4505+
with self.subTest(instance=instance):
45064506
actual = self.get_suggestion(instance, "pop")
45074507
self.assertIn("name 'qq' is not defined", actual)
45084508
self.assertEqual(actual.count("NameError"), 1)

Lib/traceback.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1523,7 +1523,7 @@ def _compute_suggestion_error(exc_value, tb, wrong_name):
15231523
try:
15241524
if hasattr(self, wrong_name):
15251525
return f"self.{wrong_name}"
1526-
except Exception:
1526+
except NameError:
15271527
return None
15281528

15291529
try:

0 commit comments

Comments
 (0)