-
Notifications
You must be signed in to change notification settings - Fork 246
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
fix(python): self
as property name leads to assignment error
#1330
Conversation
When a property with the name `self` exists in a class, it leads to a runtime error. See this definition ```python class AwsDefaultSecurityGroupPropsIngressProps(): def __init__(self, *, self: bool): """ :param self: - """ self._values = { 'self': self, } ```
The title of this Pull Request does not conform with [Conventional Commits] guidelines. It will need to be adjusted before the PR can be merged. |
Thanks for this contribution! This is currently missing a test that demonstrates the issue is fixed. I think right now this will cause a warning to be emitted, but it will not fix code generation so the name is correctly slugified. |
self
as property name leads to assignment errorself
as property name leads to assignment error
Could you point me to a similar test?
Yes, I think so too. What would be the correct way to slugify this? |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
With respects to the slugification, there appears to be a duplicated reserved words list in jsii/packages/jsii-pacmak/lib/targets/python.ts Lines 71 to 76 in 1ff2557
With respects to the tests... This is going to involve:
In any case - we'll happily provide help if you don't know how to proceed! |
Reading up a bit, it appears that I reckon the real fix is going to possibly be with code-generation of instance methods in I can let you have a look here and see if you find your way around what needs to change... And then I can have a look, too, if you get nowhere or can't afford to spend that kind of time on this :) |
Cool, thanks for providing me the context. I'll take a look at it. |
I have improved the solution here, but realized the current Submodules feature of This would need fixing before the compliance test can be added, however we could ship as-is since the original bug is likely addressed. I'd still kind of prefer being able to add the next test however (because I'm not sure the instance property/method name conflict results in code that'll behave as intended). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Pull request has been modified.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! ❤️ I will now look into making sure the PR is up-to-date, then proceed to try and merge it! |
Merging (with squash)... |
When a property with the name
self
exists in a class, it leads toa runtime error. This slugifies the conventional
self
parameteras needed to avoid this problem without compromising on the
developer experience.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.