MCPcopy Index your code
hub / github.com/python/cpython / test_binary_subscr_getitem

Method test_binary_subscr_getitem

Lib/test/test_opcache.py:664–691  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

662
663 @requires_specialization
664 def test_binary_subscr_getitem(self):
665 def get_items():
666 class C:
667 __getitem__ = lambda self, item: None
668
669 items = []
670 for _ in range(self.ITEMS):
671 item = C()
672 items.append(item)
673 return items
674
675 def read(items):
676 for item in items:
677 try:
678 item[None]
679 except TypeError:
680 pass
681
682 def write(items):
683 for item in items:
684 try:
685 del item.__getitem__
686 except AttributeError:
687 pass
688 type(item).__getitem__ = lambda self, item: None
689
690 opname = "BINARY_OP_SUBSCR_GETITEM"
691 self.assert_races_do_not_crash(opname, get_items, read, write)
692
693 @requires_specialization
694 def test_binary_subscr_list_int(self):

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected