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

Enforce object type for weak properties #215

Merged

Conversation

samschott
Copy link
Member

This PR enforces that the vartype of weak properties must be map to objc_id or py_object, i.e., that the property has an object type. This is because creating and storing weak reference in Objective-C is only supported for object types.

If a weak property is declared with a primitive C type or anything that maps to a primitive ctype, setting the value will succeed without an error but retrieving the value will return something entirely different.

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

@samschott samschott force-pushed the enforce-object-type-for-weak-properties branch from 75794f1 to 4afea92 Compare August 16, 2021 15:08
Copy link
Collaborator

@dgelessus dgelessus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Nicely spotted, and thanks for fixing it!

rubicon/objc/api.py Outdated Show resolved Hide resolved
@dgelessus dgelessus merged commit 02d169d into beeware:master Aug 17, 2021
@samschott samschott deleted the enforce-object-type-for-weak-properties branch August 17, 2021 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants