Esempio n. 1
0
 def _import_wrapper(level, fromlist, name, *, _getframe=sys._getframe):
     calling_frame = _getframe(1)
     return thunk(
         __import__,
         name,
         calling_frame.f_globals,
         calling_frame.f_locals,
         fromlist,
         level,
     )
Esempio n. 2
0
    def _start_dict_comprehension(self, instr, *instrs):
        yield instructions.LOAD_CONST(thunk(dict)).steal(instr)
        # TOS  = thunk(dict)

        yield instructions.STORE_FAST('__comp_accumulator__')

        *body, map_add = instrs
        yield from self.patterndispatcher(body)
        # TOS  = k
        # TOS1 = v

        yield instructions.LOAD_FAST('__comp_accumulator__').steal(map_add)
        # TOS  = __map__
        # TOS1 = k
        # TOS2 = v

        yield instructions.ROT_TWO()
        # TOS  = k
        # TOS1 = __map__
        # TOS2 = v

        yield instructions.STORE_SUBSCR()
        self.begin(IN_COMPREHENSION)
Esempio n. 3
0
def _lazy_is(a, b, *, is_=is_):
    return thunk(is_, a, b)
Esempio n. 4
0
def _lazy_not(a, *, not_=not_):
    return thunk(not_, a)
Esempio n. 5
0
def _lazy_is(a, b, *, is_=is_):
    return thunk(is_, a, b)
Esempio n. 6
0
def _lazy_not(a, *, not_=not_):
    return thunk(not_, a)
Esempio n. 7
0
        def _build_map(self, instr):
            yield instructions.LOAD_CONST(thunk(dict)).steal(instr)
            # TOS  = m = thunk(dict)

            yield from (instructions.DUP_TOP(),) * instr.arg