-
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: cannot extend generated classes in an idiomatic way #3656
Labels
Comments
gshpychka
added
bug
This issue is a bug.
needs-triage
This issue or PR still needs to be triaged.
labels
Jul 12, 2022
peterwoodworth
added
effort/medium
Medium work item – a couple days of effort
p1
and removed
needs-triage
This issue or PR still needs to be triaged.
labels
Jul 21, 2022
Hey! Can you provide a minimal repro for this issue? That'll help me diagnose & fix it faster... Thanks! |
|
RomainMuller
added a commit
that referenced
this issue
Aug 2, 2022
The callback logic in the jsii runtime library for Python was incorrectly passing keyword arguments to Python implementations, forwarding a struct instance as-is instead of destructuring it into a keyword arguments mapping. Using `inspect.signature()`, detect the presence of keyword arguments on the callback target, and destructure the struct as relevant. Fixes #3656
RomainMuller
added a commit
that referenced
this issue
Aug 2, 2022
The callback logic in the jsii runtime library for Python was incorrectly passing keyword arguments to Python implementations, forwarding a struct instance as-is instead of destructuring it into a keyword arguments mapping. Using `inspect.signature()`, detect the presence of keyword arguments on the callback target, and destructure the struct as relevant. Fixes #3656
mergify bot
pushed a commit
that referenced
this issue
Aug 2, 2022
The callback logic in the jsii runtime library for Python was incorrectly passing keyword arguments to Python implementations, forwarding a struct instance as-is instead of destructuring it into a keyword arguments mapping. Using `inspect.signature()`, detect the presence of keyword arguments on the callback target, and destructure the struct as relevant. Fixes #3656 --- 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
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Describe the bug
Take the class
NatProvider
:https://github.com/aws/aws-cdk/blob/d03543246c5659cb287566372d47564e6fc2df4c/packages/%40aws-cdk/aws-ec2/lib/nat.ts#L55
I'm implementing my own provider in Python, so I extend the class.
When I implement the
configure_nat
method, I cannot use the same method signature as in the generated classes.In the generated code, the signature for that method is the following:
When I replicate that in my child class, I cannot use this signature.
Expected Behavior
I should be able to extend the class and use the method signatures that match the ones in the generated python code for the parent class.
Current Behavior
When I replicate the method with the same signature, I get this at synth:
To actually implement the class, my method signature has to be:
Reproduction Steps
Subclass
NatProvider
and implementconfigure_nat
with a method signature that matches the generated parent class.Possible Solution
No response
Additional Information/Context
No response
SDK version used
1.61.0
Environment details (OS name and version, etc.)
Linux
The text was updated successfully, but these errors were encountered: