-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(python): unable to override methods with keyword arguments (#3695)
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
- Loading branch information
1 parent
5275da6
commit bcffb4b
Showing
14 changed files
with
885 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export abstract class OverrideMe { | ||
public static callAbstract(receiver: OverrideMe): boolean { | ||
return receiver.implementMe({ | ||
name: 'John Doe', | ||
// Decided not to pass count here... | ||
}); | ||
} | ||
|
||
public abstract implementMe(opts: ImplementMeOpts): boolean; | ||
} | ||
|
||
export interface ImplementMeOpts { | ||
readonly name: string; | ||
readonly count?: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.