Skip to content
Snippets Groups Projects
Select Git revision
  • e563593e87be305bcdc20ded3ec00b3f6f80da9e
  • ctx default
  • master protected
  • rahix/bhi160-cleanup
  • schneider/ble-hid
  • schneider/bsec
  • schneider/212-reset-hardware-when-entering-repl
  • schneider/exnostat-remove-gapple
  • schneider/g-watch
  • schneider/ble-time
  • schneider/bonding-fail-if-full
  • schneider/bonding-naming
  • schneider/rng-btle
  • schneider/trng-enable-fix
  • schneider/sdk-0.2.1-12
  • schneider/ble-critical-section
  • schneider/covid-tracing
  • schneider/ble-fixes-2020-3
  • schneider/spo2-playground
  • schneider/mpy-portstate
  • schneider/fix-ble-mac-write
  • v1.15
  • v1.14
  • v1.13
  • v1.12
  • v1.11
  • v1.10
  • v1.9
  • v1.8
  • v1.7
  • v1.6
  • v1.5
  • v1.4
  • v1.3
  • v1.2
  • v1.1
  • v1.0
  • release-1
  • bootloader-v1
  • v0.0
40 results

fix-multi-decl.py

Blame
  • Forked from card10 / firmware
    Source project has a limited visibility.
    gen_yield_from_throw.py 578 B
    def gen():
        try:
            yield 1
        except ValueError:
            print("got ValueError from upstream!")
        yield "str1"
        raise TypeError
    
    def gen2():
        print((yield from gen()))
    
    g = gen2()
    print(next(g))
    print(g.throw(ValueError))
    try:
        print(next(g))
    except TypeError:
        print("got TypeError from downstream!")
    
    # case where generator doesn't intercept the thrown/injected exception
    def gen3():
        yield 123
        yield 456
            
    g3 = gen3()
    print(next(g3))
    try:
        g3.throw(StopIteration)
    except StopIteration:
        print('got StopIteration from downstream!')