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

Method test_load_attr_method_no_dict

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

Source from the content-addressed store, hash-verified

917
918 @requires_specialization
919 def test_load_attr_method_no_dict(self):
920 def get_items():
921 class C:
922 __slots__ = ()
923 m = lambda self: None
924
925 items = []
926 for _ in range(self.ITEMS):
927 item = C()
928 items.append(item)
929 return items
930
931 def read(items):
932 for item in items:
933 try:
934 item.m()
935 except AttributeError:
936 pass
937
938 def write(items):
939 for item in items:
940 try:
941 del item.m
942 except AttributeError:
943 pass
944 type(item).m = lambda self: None
945
946 opname = "LOAD_ATTR_METHOD_NO_DICT"
947 self.assert_races_do_not_crash(opname, get_items, read, write)
948
949 @requires_specialization
950 def test_load_attr_method_with_values(self):

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected