[Pyrex] Anyone used VendorID with Pyrex?
Greg Ewing
greg.ewing at canterbury.ac.nz
Wed Mar 30 03:23:28 CEST 2005
Matt Campbell wrote:
>
> I recently read about a package called VendorID
> (http://www.riverbankcomputing.co.uk/vendorid/), which allows one to
> restrict the usage of some extension modules to specific Python
> interpreter binaries. This is useful for redistributing Python bindings
> for commercial libraries, such as PyQt.
Is this really necessary? As an extension writer, I wouldn't
consider it my job to attempt to enforce someone else's
license restriction. It's impossible anyway -- there's nothing
to stop someone modifying their Python interpreter to look
however the check wants, or writing their own wrapper for
the library.
> The tricky part is that extension modules
> which use VendorID must call vendorid_check(), check the return value,
> and raise an exception if the return value is zero, before calling
> Py_InitModule(). I'm guessing that it would be necessary to patch Pyrex
> to do this.
Yes, you'd have to modify either Pyrex or the generated C code,
because Pyrex code doesn't get control until after Py_InitModule()
is called.
If you want to modify the Pyrex compiler, you could start by
looking at Pyrex.Compiler.Nodes.ModuleNode.generate_module_init_func(),
which is where the initxxx() function gets generated.
--
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury, | A citizen of NewZealandCorp, a |
Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. |
greg.ewing at canterbury.ac.nz +--------------------------------------+
More information about the Pyrex
mailing list