Skip to content

Commit b485677

Browse files
gh-143544: Tighten regression test exception assertion
1 parent 0593e2f commit b485677

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

Lib/test/test_json/test_fail.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,6 @@ def test_linecol(self):
242242
def test_reentrant_jsondecodeerror_does_not_crash(self):
243243
# gh-143544
244244

245-
orig_json_error = json.JSONDecodeError
246-
orig_decoder_error = json.decoder.JSONDecodeError
247-
248245
class Trigger:
249246
def __call__(self, *args, **kwargs):
250247
# Remove JSONDecodeError during construction to trigger re-entrancy
@@ -259,7 +256,7 @@ def __call__(self, *args, **kwargs):
259256
):
260257
# The exact exception type is not important here;
261258
# this test only ensures we don't crash.
262-
with self.assertRaises(Exception):
259+
with self.assertRaises(self.JSONDecodeError):
263260
json.loads('"\\uZZZZ"')
264261

265262

0 commit comments

Comments
 (0)