Means to expose functions from modules#227
Merged
jeff5 merged 6 commits intojython:mainfrom Feb 4, 2023
Merged
Conversation
PyJavaMethod represents bound and unbound *methods* (name 'builtin_function_or_method'). CPython calls the same idea PyCFunction. PEP 573 introduces a PyCMethod (name 'builtin_method') for methods of types in modules. It's going to be confusing if we don't go with PyJavaFunction.
Port the basic apparatus of modules defined in Java from VSJ and a test. Rationalise ArgParser to eliminate a legacy constructor.
Member
Author
|
This change brings over the basic apparatus of modules defined in Java, and a fairly complete exposure mechanism. A test shows that we can build by reflection a module definition that is somewhat like the PyMethodDef table found in CPython modules. |
As a result we find and fix a bug and some inefficiencies in PyJavaFunction calls.
Separate extension module initialisation into create and exec phases, roughly as PEP 489.
We implement a few built-in functions and object references, and a unit test of the functions. The Interpreter now makes itself an instance of the module so that it is available to the frame.
With a few adjustments to the interpreter frame and the function object, we show that we can access the contents of the builtins module as we interpret CPython byte code.
Member
Author
|
This seems like a good place to stop and invite comment (if any available). I'll merge in a week or so. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR will introduce by stages a tested mechanism to define built-in modules and potentially third-party extensions. The Java methods in classes identified as Python modules will appear to Python as functions. The intent is described in Python Modules in Java.
Built-in functions in modules look different from bound methods on objects, but they are in fact the same object type:
For technical reasons, we start by renaming the implementation class
PyJavaMethodtoPyJavaFunction.Draft for now.