8000 Raise NotImplementedError · python/cpython@1a63f5d · GitHub
[go: up one dir, main page]

Skip to content

Commit 1a63f5d

Browse files
committed
Raise NotImplementedError
1 parent b66ad8b commit 1a63f5d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Lib/test/test_type_annotations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ class X:
315315
def test_module(self):
316316
ns = run_code("x: undefined = 1")
317317
anno = ns["__annotate__"]
318-
with self.assertRaises(AssertionError): # TODO NotImplementedError
318+
with self.assertRaises(NotImplementedError):
319319
anno(2)
320320

321321
with self.assertRaises(NameError):
@@ -350,8 +350,8 @@ class X:
350350
annotate = obj.__annotate__
351351
self.assertIsInstance(annotate, types.FunctionType)
352352
self.assertEqual(annotate.__name__, f"<annotations of {obj.__name__}>")
353-
with self.assertRaises(AssertionError): # TODO NotImplementedError
353+
with self.assertRaises(NotImplementedError):
354354
annotate(inspect.FORWARDREF)
355-
with self.assertRaises(AssertionError): # TODO NotImplementedError
355+
with self.assertRaises(NotImplementedError):
356356
annotate(None)
357357
self.assertEqual(annotate(inspect.VALUE), {"x": int})

Python/compile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1658,7 +1658,7 @@ compiler_leave_annotations_scope(struct compiler *c, location loc,
16581658
ADDOP_I(c, loc, BUILD_MAP, annotations_len);
16591659
ADDOP_IN_SCOPE(c, loc, RETURN_VALUE);
16601660
USE_LABEL(c, label);
1661-
ADDOP_IN_SCOPE(c, loc, LOAD_ASSERTION_ERROR);
1661+
ADDOP_I(c, loc, LOAD_COMMON_CONSTANT, CONSTANT_NOTIMPLEMENTEDERROR);
16621662
ADDOP_I(c, loc, RAISE_VARARGS, 1);
16631663
PyCodeObject *co = optimize_and_assemble(c, 1);
16641664
compiler_exit_scope(c);

0 commit comments

Comments
 (0)
0