-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python: Ec2Service.placeSpreadAccross example is broken #483
Comments
I'm getting the same error when using
|
Taking a look now. |
I ran into this same error when using As an aside, fixing that reveals another issue with the |
I think there are a couple of problems. First, the code generator for variadic args is wrapping the tuple passed to the method in a list, like this:
The list gets unpacked and then the tuple contained within it isn't handled properly and causes the above The second problem is that the Python kernel is not handling tuples, only lists. So code like:
needs to handle tuples as well as lists. |
I was unaware that the Python CDK was auto-generated, that's pretty nifty. I guess it also means that the issue I opened on the CDK repo isn't super relevant over there. Digging into the code generator, it seems like this line in code.line(`${methodPrefix}jsii.${this.jsiiMethod}(${jsiiMethodParams.join(", ")}, [${paramNames.join(", ")}])`); I don't have any experience with TypeScript, but this seems like you could solve the unpacking issue like so: // If the args are variadic, expand the last one
let modifiedParamNames: string[] = paramNames.slice();
if (this.parameters.length >= 1 && this.parameters[this.parameters.length - 1].variadic) {
modifiedParamNames.push("*" + modifiedParamNames.pop());
}
code.line(`${methodPrefix}jsii.${this.jsiiMethod}(${jsiiMethodParams.join(", ")}, [${modifiedParamNames.join(", ")}])`); |
The example https://github.com/aws-samples/aws-cdk-examples/tree/master/python/ecs/ecs-service-with-task-placement is broken in Python:
leads to
Method is variadic, is that the problem? Or it might be about the constant definition.
https://alpha-docs-aws.amazon.com/CDK/api/preview/docs/@aws-cdk_aws-ecs.Ec2Service.html#placespreadacrossfields-void
The text was updated successfully, but these errors were encountered: