Is it possible to hint PyCharm that method is always raising exception to calm "uninitialized variable" warnings?

With twisted framework and generators-based async coding style it is common to have code like that:

try:
    result = yield some_async_method()
except SomeException:
    defer.returnValue(None)

do_something(result)

PyCharm is correctly pointing that `do_something(result)` might use uninitialized variable `result`. But I know that this is ok since `returnValue` is always raising an exception, so we never get past this try...except with unitialized `result`. Is it possible to give PyCharm a hint about this particular function is never returning and always raising exception?

 

Thanks

1 comment
Comment actions Permalink

Interested in this as well... Any solution?

0

Please sign in to leave a comment.