Skip to content

Commit

Permalink
fix(python): cannot call a method that takes an empty struct (#3372)
Browse files Browse the repository at this point in the history
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



---

By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
  • Loading branch information
RomainMuller committed Feb 8, 2022
1 parent 9cda666 commit c36b67c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/@jsii/python-runtime/src/jsii/_kernel/__init__.py
Expand Up @@ -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,
Expand Down

0 comments on commit c36b67c

Please sign in to comment.