Skip to content

Means to expose attributes and members of built-in types#210

Merged
jeff5 merged 6 commits intojython:mainfrom
jeff5:expose-bi-attr-3.8
Dec 17, 2022
Merged

Means to expose attributes and members of built-in types#210
jeff5 merged 6 commits intojython:mainfrom
jeff5:expose-bi-attr-3.8

Conversation

@jeff5
Copy link
Copy Markdown
Member

@jeff5 jeff5 commented Sep 23, 2022

Another chunk of the exposure mechanism, following up from #205 and only slightly less of a leap. (#205 stopped at methods.)

@fwierzbicki : pinging you again for your interest.

We define exposure for members of built-in types by addition of the
mechanisms to TypeExposer. There is a fairly thorough test.
We define exposure for attributes (with implementor-defined protocols)
of built-in types by addition of the mechanisms to TypeExposer. There is
a fairly thorough test.
We beef up a test of the mechanism for exposing types. Also, use the
annotations in a few places. (Many others potentially.)
@fwierzbicki
Copy link
Copy Markdown
Member

@jeff5 This looks great! Also (I know you've been doing this all along but) I want to say that I especially love how you put in comments like "Compare CPython descr_setcheck in descrobject.c" <- these pointers will be invaluable to future contributors.

@jeff5 jeff5 marked this pull request as draft December 16, 2022 07:30
@jeff5
Copy link
Copy Markdown
Member Author

jeff5 commented Dec 16, 2022

I think there is some more to do here to get the annotations working as desired. In particular we ought to be able to inherit down the Java line (as well as Python inheritance through the __dict__ that does work) so that we don't have to define members repeatedly. This comes up in the failure to expose fields Java-inherited from the base Descriptor class, because it is not a Python class.

Previously, the TypeExposer would miss Member annotations added to
fields in the super-class of an exposed type. We demonstrate success in
an improved test. A real example is the __name__ attribute of descriptor
objects which we like to inherit from Descriptor.
In particular, we test that get-set attribute definitions can be
Java-inherited.
Merging from main to fix Python version
@jeff5 jeff5 marked this pull request as ready for review December 17, 2022 07:01
@jeff5
Copy link
Copy Markdown
Member Author

jeff5 commented Dec 17, 2022

Although I usually leave these a few weeks after the final change, the bulk of this has had that chance so will merge shortly.

@jeff5 jeff5 merged commit 03cc1f1 into jython:main Dec 17, 2022
@jeff5 jeff5 deleted the expose-bi-attr-3.8 branch December 17, 2022 12:04
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.

2 participants