~jasper/type_stack_calc

ref: 6aca66fb1a7cf1e10f7dd3263f04537c8ff37590 type_stack_calc/type_stack_calc/util/stack_check.py -rw-r--r-- 409 bytes
6aca66fb — Jasper den Ouden Apparently `to_c` can already read ahead one, hopefully its this simple... 1 year, 1 month ago
                                                                                
1
2
3
4
5
6
7
8
def assert_acceptable_vals(in_gen, *ctx, desc=None):
    """Checks for values it expects _not_ to be present in values that go onto the stack."""
    ctx = (desc +'\n' if desc else "") + \
         "\n ctx: " + '\n'.join(map(repr, ctx))
    for i, el in enumerate(in_gen):
        assert type(el) not in {type(None), float, int, bool}, \
            f"Expected no `{el}`({type(el)}), but got for {i}\n{ctx}"