[Cython] CF and finally clause

Robert Bradshaw robertwb at math.washington.edu
Tue May 24 22:07:02 CEST 2011


On Tue, May 24, 2011 at 12:33 PM, Vitja Makarov <vitja.makarov at gmail.com> wrote:
> Hi!
>
> When I create control flow graph I have to visit finally clause twice.
> This is required because of different outputs should be generated for
> success and exception case:
>
> try:
>    a = might_raise()
> finally:
>    pass # 'a' might be uninitialized here
> print(a)  # and definitely defined here
>
> So after tracking both cases I have to merge states back because same
> code is generated for each.
>
> Maybe it's a good idea to split success/exception case by copying it
> at PostParse transform?

-1

I don't see any difference compared to merging the states from

if b:
    a = None
else:
    # don't assign to a

- Robert


More information about the cython-devel mailing list