Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sdk/python] Ensure Output objects are not iterable #7288

Merged
merged 3 commits into from
Jun 14, 2021
Merged

Conversation

lukehoban
Copy link
Member

Although Output objects can never correctly support iteration, Python will see the implementation of __getitem__ and try to iterate the object, leading to an infinite loop. To prevent this, we need to explicitly implement __iter__ and make it return a TypeError to prevent iteration (and offer a useful error message).

Fixes #5028.

Although Output objects can never correct support iteration, Python will see the implementation of `__getitem__` and try to iterate the object, leading to an infinite loop.  To prevent this, we need to explicitly implement __iter__ and make it return a TypeError to prevent iteration (and offer a useful error message).

Fixes #5028.
sdk/python/lib/test/test_output.py Outdated Show resolved Hide resolved
Co-authored-by: Justin Van Patten <jvp@justinvp.com>
@lukehoban lukehoban merged commit 965d23b into master Jun 14, 2021
@pulumi-bot pulumi-bot deleted the lukehoban/5028 branch June 14, 2021 23:25
blarghmatey added a commit to mitodl/ol-infrastructure that referenced this pull request Aug 3, 2021
- Pulumi removed support for iteration of `Output` objects due to infinite iteration problems [here](pulumi/pulumi#7288). This fixes our use of iterators for the IPv6 network blocks.
- Remove KMS VPC endpoint for now as it adds more complexity, requiring assignment of a security group to manage access.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Output in Python allows infinite iteration
2 participants