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

Python: Property called 'property' makes Python file unimportable #1113

Closed
rix0rrr opened this issue Dec 11, 2019 · 0 comments · Fixed by #1114
Closed

Python: Property called 'property' makes Python file unimportable #1113

rix0rrr opened this issue Dec 11, 2019 · 0 comments · Fixed by #1114
Labels
bug This issue is a bug. language/python Related to Python bindings p1

Comments

@rix0rrr
Copy link
Contributor

rix0rrr commented Dec 11, 2019

🐛 Bug Report

This is high priority because the documentation build fails while this issue is present.

@aws-cdk/aws-accessanalyzer is a new package from the CFN spec... and it has a struct CfnAnalyzer.FilterProperty with a property called property...

Since properties are generated in Python as:

@property
def some_prop(self):
  ...

@property
def property(self):
  ...

The presence of def property makes the annotation @property resolve to something else.

 File "/tmp/python/venv/lib64/python3.7/site-packages/aws_cdk/aws_accessanalyzer/__init__.py", line 40, in <module> 
    class CfnAnalyzer(aws_cdk.core.CfnResource, metaclass=jsii.JSIIMeta, jsii_type="@aws-cdk/aws-accessanalyzer.CfnAnalyzer"): 
  File "/tmp/python/venv/lib64/python3.7/site-packages/aws_cdk/aws_accessanalyzer/__init__.py", line 196, in CfnAnalyzer 
    @jsii.data_type(jsii_type="@aws-cdk/aws-accessanalyzer.CfnAnalyzer.FilterProperty", jsii_struct_bases=[], name_mapping={'property': 'property', 'contains': 'contains', 'eq': 'eq', 'exists': 'exists', 'neq': 'neq'}) 
  File "/tmp/python/venv/lib64/python3.7/site-packages/aws_cdk/aws_accessanalyzer/__init__.py", line 227, in FilterProperty 
    def contains(self) -> typing.Optional[typing.List[str]]: 
TypeError: 'property' object is not callable 
@rix0rrr rix0rrr added bug This issue is a bug. language/python Related to Python bindings p1 labels Dec 11, 2019
RomainMuller added a commit that referenced this issue Dec 11, 2019
When a member is named `property`, it would start taking precedence over
`builtings.property` when resolving the `@property` decorator. Fixed
this by manually namespacing all `@<decorator>`, so local scope
declarations cannot possibly shadow decorators.

Fixes #1113
RomainMuller added a commit that referenced this issue Dec 11, 2019
When a member is named `property`, it would start taking precedence over
`builtings.property` when resolving the `@property` decorator. Fixed
this by manually namespacing all `@<decorator>`, so local scope
declarations cannot possibly shadow decorators.

Fixes #1113
@mergify mergify bot closed this as completed in #1114 Dec 11, 2019
mergify bot pushed a commit that referenced this issue Dec 11, 2019
When a member is named `property`, it would start taking precedence over
`builtings.property` when resolving the `@property` decorator. Fixed
this by manually namespacing all `@<decorator>`, so local scope
declarations cannot possibly shadow decorators.

Fixes #1113
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. language/python Related to Python bindings p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant