Skip to content
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

Use ismethod to detect methods used as a transformation #2469

Merged
merged 3 commits into from
Jun 27, 2023

Conversation

Kody-Quintana
Copy link
Contributor

@Kody-Quintana Kody-Quintana commented Jun 25, 2023

Proposed changes

This changes the value that is used to compare against the number of args of a transformation callable's arg spec when determining whether or not to call the transformation with t(obj, opts) or just t(obj).

The returned value from len(getfullargspec(t)[0]) will include the self and cls args from a method, but when calling a method the first argument is implicitly added so if you use a method for t it will fail.

This changes the value to be 3 if t is a method.

Related issues (optional)

Fix #2468

@github-actions
Copy link

PR is now waiting for a maintainer to run the acceptance tests.
Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

@lblackstone
Copy link
Member

/run-acceptance-tests

@pulumi-bot
Copy link
Contributor

@lblackstone
Copy link
Member

Thanks for the thorough writeup and fix @Kody-Quintana! I kicked off the CI tests to check, but the code change LGTM.

@github-actions
Copy link

PR is now waiting for a maintainer to run the acceptance tests.
Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

@github-actions
Copy link

PR is now waiting for a maintainer to run the acceptance tests.
Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

@lblackstone lblackstone enabled auto-merge (squash) June 27, 2023 19:04
@lblackstone lblackstone merged commit 54c4096 into pulumi:master Jun 27, 2023
9 of 10 checks passed
@Kody-Quintana
Copy link
Contributor Author

Thanks for taking the time to look at this, very appreciated

@Kody-Quintana Kody-Quintana deleted the methods-as-transformations branch June 27, 2023 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants