diff --git a/packages/jsii-pacmak/lib/targets/python/type-name.ts b/packages/jsii-pacmak/lib/targets/python/type-name.ts index 835ee90163..c532a26972 100644 --- a/packages/jsii-pacmak/lib/targets/python/type-name.ts +++ b/packages/jsii-pacmak/lib/targets/python/type-name.ts @@ -311,7 +311,7 @@ class UserType implements TypeName { const wrapType = typeAnnotation && parameterType && isStruct ? (pyType: string) => - `typing.Union[${pyType}, typing.Dict[str, typing.Any]]` + `typing.Union[${pyType}, typing.Dict[builtins.str, typing.Any]]` : (pyType: string) => pyType; // Emit aliased imports for dependencies (this avoids name collisions) diff --git a/packages/jsii-pacmak/test/targets/python/type-name.test.ts b/packages/jsii-pacmak/test/targets/python/type-name.test.ts index 0d7b6368bf..7dc95c6b5c 100644 --- a/packages/jsii-pacmak/test/targets/python/type-name.test.ts +++ b/packages/jsii-pacmak/test/targets/python/type-name.test.ts @@ -246,8 +246,8 @@ describe(toTypeName, () => { { name: 'Struct parameter type annotation', input: { fqn: `${assembly.name}.Struct` }, - forwardPythonType: `typing.Union["Struct", typing.Dict[str, typing.Any]]`, - pythonType: `typing.Union[Struct, typing.Dict[str, typing.Any]]`, + forwardPythonType: `typing.Union["Struct", typing.Dict[builtins.str, typing.Any]]`, + pythonType: `typing.Union[Struct, typing.Dict[builtins.str, typing.Any]]`, context: { typeAnnotation: true, parameterType: true,