From e7ffa17f91d2ac6ab2cc806705a5090a442d6f07 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 | 3 +++ 2 files changed, 7 insertions(+) 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..6571793e8677 100644 --- a/sdk/python/lib/pulumi/runtime/resource.py +++ b/sdk/python/lib/pulumi/runtime/resource.py @@ -682,6 +682,9 @@ def register_resource_outputs( ): async def do_register_resource_outputs(): urn = await res.urn.future() + # 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). + outputs = {} if outputs is None else outputs serialized_props = await rpc.serialize_properties(outputs, {}) log.debug( f"register resource outputs prepared: urn={urn}, props={serialized_props}"