[sdk/python] Avoid 'referenced before assignment' error (#7135)

We have seen cases where a lot of errors like this are reported:

```
UnboundLocalError: local variable 'resources' referenced before assignment
```

This change prevents this failure mode, which might be a symptom of some
other issue, but currently obscures it in the error path.
This commit is contained in:
Luke Hoban 2021-11-16 13:57:09 -08:00 committed by GitHub
parent ba39ed9ad4
commit ed769377dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -152,6 +152,7 @@ class Output(Generic[T_co]):
# The "run" coroutine actually runs the apply.
async def run() -> U:
resources: Set['Resource'] = set()
try:
# Await this output's details.
resources = await self._resources