Skip to content

Commit

Permalink
fix(python): module import fails with: KeyError: '__all__' (#2757)
Browse files Browse the repository at this point in the history
Always emit an `__all__` declaration even if the module does not export
anything.

Fixes #2750



---

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 authored Mar 30, 2021
1 parent 0a3f01f commit c32a889
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/jsii-pacmak/lib/targets/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1597,6 +1597,8 @@ class PythonModule implements PythonType {
code.line(`${member},`);
}
code.unindent(']');
} else {
code.line('__all__: List[typing.Any] = []');
}

// Finally, we'll use publication to ensure that all of the non-public names
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c32a889

Please sign in to comment.