[Pyrex] pyrex for parrots?

Greg Ewing greg at cosc.canterbury.ac.nz
Thu May 19 03:49:02 CEST 2005


Michal Wallace wrote:

> Parrot's internal object system is very similar
> to python's. A PMC (Parrot Magic Cookie - don't
> ask me why they called it that)

That should be "Parrot Magic Cracker", surely?-)

> is almost
> identical to a PythonObject. To me, it should be possible to write a 
> generic wrapper that would allow Parrot to use python's native types.
> 
> However, I'm not much of a C programmer... And I'm wondering if it would 
> be possible to use
> pyrex to help with this task.

It might be possible, although I'm not sure how much
help Pyrex would be. Especially considering your remark

> From my experiments, it seems that PythonObjects
> work just fine outside of a python interpreter,
> if you replace the reference counting and interpreter
> locking functions with stubs,

That sounds very scary and dangerous. Pyrex assumes
the code it generates is going to run as a module
imported into a fully functioning Python system, and
relies on Python's reference counting to deallocate
temporary objects that it creates.

Even without Pyrex, I wouldn't feel confident that
complex builtin types such as dictionaries would work
correctly in a refcount-disabled environment, since
their implementation may be using other Python
objects internally.

In short, to pull this off you'd have to be *very*
familiar with the internals of Python's implementation,
whether you use Pyrex or not. Pyrex isn't going to
provide any easy solutions if you insist on doing
something as radical as disabling refcounting.

Greg




More information about the Pyrex mailing list