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}" )