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] Cast numbers intended to be integers to int #5419

Merged
merged 1 commit into from
Sep 20, 2020

Conversation

justinvp
Copy link
Member

We recently made a change to the Python codegen to emit int type annotations, instead of float, for properties that are typed as schema.IntType.

But the number values that come back from protobuf structs are always floats (like JSON), so we need to cast the values intended to be integers to int.

Fixes #5418

We recently made a change to the Python codegen to emit `int` type annotations, instead of `float`, for properties that are typed as `schema.IntType`.

But the number values that come back from protobuf structs are always floats (like JSON), so we need to cast the values intended to be integers to `int`.
@justinvp
Copy link
Member Author

I tried out the Python example being added in pulumi/examples#799. Before these changes, I observed the same error mentioned in #5418. Then I installed a local build of the Python SDK with the changes from this PR and the pulumi up worked without error.

@justinvp justinvp merged commit 5794a3f into master Sep 20, 2020
@pulumi-bot pulumi-bot deleted the justin/py_sdk_int branch September 20, 2020 04:10
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.

Python: Functions that return numbers result in TypeError
2 participants