From 6a4a3ce00c1d68f943ff8244c91cf1b91710583e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=A7=91=F0=9F=8F=BB=E2=80=8D=F0=9F=92=BB=20Romain=20M?= =?UTF-8?q?arcadier?= Date: Tue, 8 Feb 2022 13:55:08 +0100 Subject: [PATCH] fix(python): cannot call a method that takes an empty struct Empty dictionaries are false-y in Python, so the test that checked for structs via the existence of a property mapping table was incorrect, as it only checked truthiness of the mapping, instead of checking for it being non-`None`. Fixes #2846 --- packages/@jsii/python-runtime/src/jsii/_kernel/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@jsii/python-runtime/src/jsii/_kernel/__init__.py b/packages/@jsii/python-runtime/src/jsii/_kernel/__init__.py index 95959e7f62..0d41d13b28 100644 --- a/packages/@jsii/python-runtime/src/jsii/_kernel/__init__.py +++ b/packages/@jsii/python-runtime/src/jsii/_kernel/__init__.py @@ -169,7 +169,7 @@ def _make_reference_for_native(kernel, d): from .._runtime import python_jsii_mapping mapping = python_jsii_mapping(d) - if mapping: # This means we are handling a data_type (aka Struct) + if mapping is not None: # This means we are handling a data_type (aka Struct) return { "$jsii.struct": { "fqn": typeFqn,