KOS_OP_MATCH_CLASS_VAR / KOS_OP_MATCH_CLASS_FAST
Style: EXTRA (LABEL, VAR, RAW) on
MATCH_CLASS_VAR, (LABEL, FASTVAR, RAW) onMATCH_CLASS_FAST: label, class, positional field count.Stack:
[..., e]->[..., e]; jump toa0on a miss,eleft either way.Semantics:
eread throughDatummust be an instance of the class in the variablea1, read by name on the_VARform and by fast index on the_FASTform; a non-instance is a miss. The class’s__match_args__must then hold at leasta2names: a class with no__match_args__, a__match_args__that is not a tuple, or one shorter thana2raisesTypeErrorbefore any attribute ofeis read. On Python 3.9 a dataclass or named tuple without__match_args__reads the equivalent tuple Python 3.10 would generate.Compiler form: Emitted by the match compiler for the instance check of a class pattern with positional fields,
a2their count; the_VARform pre-compile, the_FASTtwin onceconvert_fasthas lowered the variable.