Lisandro Dalcin wrote:
> On Wed, Oct 14, 2009 at 12:38 PM, Stefan Behnel wrote:
>> This is now ticket 407:
>>
>> http://trac.cython.org/cython_trac/ticket/407
> 
> And now you have a working (2.3-2.7 and 3.1-3.2) patch ready for review:
> 
> http://trac.cython.org/cython_trac/attachment/ticket/407/capi-import-export.diff

Ok, that's a pretty straight-forward change. I didn't test it yet, but it
looks good to me. Please push it.

One remark: the Py3 docs contain this section:

"""
Whichever method you choose, it’s important to name your Capsules properly.
The function PyCapsule_New() takes a name parameter (const char *); you’re
permitted to pass in a NULL name, but we strongly encourage you to specify
a name. Properly named Capsules provide a degree of runtime type-safety;
there is no feasible way to tell one unnamed Capsule from another.

In particular, Capsules used to expose C APIs should be given a name
following this convention:

modulename.attributename

The convenience function PyCapsule_Import() makes it easy to load a C API
provided via a Capsule, but only if the Capsule’s name matches this
convention. This behavior gives C API users a high degree of certainty that
the Capsule they load contains the correct C API.
"""

So we are not quite conformant with that as we a) do not prepend the module
name and b) append the complete signature. I actually find it much safer to
have the signature in there, and I actually doubt that the module name adds
anything to that. After all, the import goes though the module anyway.

So I actually think the way Cython does it is better than what the CPython
docs propose. Should we bring this up on python-dev?

Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to