From 0b3fdaf141c6f47500443de2c95c1fa84fb35cd5 Mon Sep 17 00:00:00 2001 From: Fraser Waters Date: Wed, 2 Nov 2022 14:02:13 +0000 Subject: [PATCH] Handle None being passed to register_resource_outputs --- ...handle-none-being-passed-to-register_resource_outputs.yaml | 4 ++++ sdk/python/lib/pulumi/runtime/resource.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelog/pending/20221102--sdk-python--handle-none-being-passed-to-register_resource_outputs.yaml diff --git a/changelog/pending/20221102--sdk-python--handle-none-being-passed-to-register_resource_outputs.yaml b/changelog/pending/20221102--sdk-python--handle-none-being-passed-to-register_resource_outputs.yaml new file mode 100644 index 000000000000..08c8d2111bb8 --- /dev/null +++ b/changelog/pending/20221102--sdk-python--handle-none-being-passed-to-register_resource_outputs.yaml @@ -0,0 +1,4 @@ +changes: +- type: fix + scope: sdk/python + description: Handle None being passed to register_resource_outputs. diff --git a/sdk/python/lib/pulumi/runtime/resource.py b/sdk/python/lib/pulumi/runtime/resource.py index 6941325f1468..a9a310e0e966 100644 --- a/sdk/python/lib/pulumi/runtime/resource.py +++ b/sdk/python/lib/pulumi/runtime/resource.py @@ -682,7 +682,9 @@ def register_resource_outputs( ): async def do_register_resource_outputs(): urn = await res.urn.future() - serialized_props = await rpc.serialize_properties(outputs, {}) + # serialize_properties expects a collection (empty is fine) but not None, but this is called pretty + # much directly by users who could pass None in (although the type hints say they shouldn't). + serialized_props = await rpc.serialize_properties(outputs or {}, {}) log.debug( f"register resource outputs prepared: urn={urn}, props={serialized_props}" )