GitHub user rectang opened a pull request:

    https://github.com/apache/lucy-clownfish/pull/60

    CLOWNFISH-66 Py glue part 3

    Gen Py glue for methods and constructors.
    
    * Autogenerate CPython glue code for methods and constructors.
    * Handle both positional and labeled args.
    * Deal with refcounting of args and return values.
    * Trap Clownfish exceptions and rethrow as Python exceptions.
    * Unit test Py binding of Hash.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/rectang/lucy-clownfish CLOWNFISH-66-py-glue3

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/lucy-clownfish/pull/60.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #60
    
----
commit cb25fd0bd79dfcd8097db6bf8c0319cb44a07531
Author: Marvin Humphrey <[email protected]>
Date:   2016-02-02T03:13:00Z

    Gen stub Py method wrappers.

commit 6a50d2179d0464048f54f021eff3e70029b6162d
Author: Marvin Humphrey <[email protected]>
Date:   2016-02-02T18:39:32Z

    Consider num args in Py binding.
    
    For generated CPython method glue code, support keyword args if the
    method takes arguments.

commit 15602e67deb05b28329c9eaf0612a739547ddf8b
Author: Marvin Humphrey <[email protected]>
Date:   2016-02-02T19:03:02Z

    Prepare to parse Python meth args.
    
    Stub out data structures into which we will read arguments from Python.

commit 74878d3ce0be405b575552dfb25caa6a00e46ba9
Author: Marvin Humphrey <[email protected]>
Date:   2016-02-02T19:09:57Z

    Detect required arg after optional.
    
    For now, Clownfish allows required arguments to appear after optional
    arguments in a parameter list.  Python does not, so we need to detect
    that error case.
    
    Eventually, we'll either fix Clownfish to take on Python's restriction,
    or else force the user to create manual glue for problematic methods.

commit 1853cbfd000430937312142034090de25de8039f
Author: Marvin Humphrey <[email protected]>
Date:   2016-02-02T21:38:19Z

    Gen CFBindArg declarations.
    
    Generate the declarations for the CFBindArg wrapper structs which are
    required by some Python argument conversion routines.

commit ba87d53627914d6815122d59e9b0ae5afbcf9e23
Author: Marvin Humphrey <[email protected]>
Date:   2016-02-02T21:42:27Z

    Gen list of converter/arg-pointer pairs.
    
    Generate the list of function-pointer/arg-pointer pairs passed which get
    passed to `PyArg_ParseTupleAndKeywords`.

commit 4cdfb56b6ed149cfef354720e7514d1d23bd8769
Author: Marvin Humphrey <[email protected]>
Date:   2016-02-02T21:45:03Z

    Build up the ParseTuple format string.

commit f11b123c496486c51d3a402e16636fc6430fe379
Author: Marvin Humphrey <[email protected]>
Date:   2016-02-23T03:34:59Z

    Declare C arg vars in Py glue.

commit a9daf3cf7bb82ee5c9f51a83b5f3d166fb35de6d
Author: Marvin Humphrey <[email protected]>
Date:   2016-02-02T23:44:10Z

    Incref `decremented` args in Py glue.
    
    For args that are specified as `decremented` in the Clownfish method
    signature, add an INCREF in the glue code.

commit d88c0bf5c19a22b655bb5c59a6f2a0d2c366f85c
Author: Marvin Humphrey <[email protected]>
Date:   2016-02-02T23:46:23Z

    Prepare decrefs to run in Py glue.

commit 71c836a2a2329c3a999ce102a6bd38f1b0f08169
Author: Marvin Humphrey <[email protected]>
Date:   2016-02-03T00:08:54Z

    Add helper for generating arg lists.

commit d8ced59cb135f628c0266e6aff0141152280f603
Author: Marvin Humphrey <[email protected]>
Date:   2016-02-03T01:13:28Z

    Register PyMethodDefs for glued methods.
    
    Create PyMethodDef entries for each wrapped Clownfish method.

commit 5443a74386b0bd6217d12c16a5ef9265c99d78c7
Author: Marvin Humphrey <[email protected]>
Date:   2016-02-03T01:50:12Z

    Stub out generated Python constructors.

commit a6068b41523b9c216bb63ace4d66f9f5cccf1477
Author: Marvin Humphrey <[email protected]>
Date:   2016-02-03T02:43:41Z

    Gen arg parsing for Py constructor glue.

commit 2e4d3d3e6292539af7aab6419286ebe1be90e5ba
Author: Marvin Humphrey <[email protected]>
Date:   2016-02-03T02:48:50Z

    Add increfs and decrefs to gen ctor glue.
    
    Incref decremented args. Signal to CFBind_run_trapped when it needs to
    decref some args.

commit 73635f233dc3a5b1addf17aacdf5773d8fad1113
Author: Marvin Humphrey <[email protected]>
Date:   2016-02-06T02:03:01Z

    Handle default values for primitive types.
    
    Set conversion args to default values prior to Python argument parsing.

commit b05965cafb60362badf530872dc81a304b9db761
Author: Marvin Humphrey <[email protected]>
Date:   2016-02-06T17:41:59Z

    More liberal Py to Cfish Obj conversion.
    
    When converting a Python argument to Clownfish `Obj*`, allow conversion
    from Python dict, list, string, integer, and other types -- instead of
    just checking to confirm that the argument is already a Clownfish Obj.

commit 674721cc3e0f7fac030cf75fcdcfc4ee3d2f539f
Author: Marvin Humphrey <[email protected]>
Date:   2016-02-23T02:29:02Z

    Test err handling in Py glue.
    
    Check that a Clownfish exception gets transformed into a Python
    exception.

commit 9d058f4b324dabf4f2cdd2ea88f40c9aabe2d622
Author: Marvin Humphrey <[email protected]>
Date:   2016-02-11T02:45:50Z

    Add test for the Py binding of Hash.

commit f624495ea3f0e80a6d95fb37d51fdb7a2b5b8124
Author: Marvin Humphrey <[email protected]>
Date:   2016-02-23T03:40:17Z

    Add actual method invocation to Py glue.

commit 8b41f26264da06c6b43655a1e939ac1123957d9d
Author: Marvin Humphrey <[email protected]>
Date:   2016-02-23T03:40:54Z

    Add actual constructor invocation to Py glue.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to