[Pyrex] Please support C++

David M. Cooke cookedm at physics.mcmaster.ca
Tue Oct 18 00:04:36 CEST 2005


"Lenard Lindstrom" <len-l at telus.net> writes:

> On 13 Oct 2005 at 16:35, Greg Ewing wrote:
>
>> Lenard Lindstrom wrote:
>> 
>> > I've made a few changes to the Pyrex-0.9.3.1 compiler so it now produces C code 
>> > that also compiles as C++ for some Pyrex programs.
> [snip]
>> > [H]how is the best way to make the patch available for general testing? At 7.5K 
>> > is it too large to be an e-mail attachment?
>> 
>> You're welcome to mail it to me and I'll put it on the
>> web page somewhere for people to try out.
>> 
>
> Update on C++ support.
>
> I can now compile all the Pyrex programs in directories 1 - 8 of the Pyrex test suite 
> as C++. But I would like to do some more rigorous testing of extension types, the 
> problem area, before submitting a patch.
>
> I do have one question regarding temporary object pointers. Pyrex has code to 
> ensure all such pointers are (PyObject *). I took out that restriction to allow 
> temporary pointers to extension types to be of the type of the extension type. This 
> simplifies the generation C casts. It appears the compiler originally allowed for non 
> (PyObject *) pointers. Does removing the restriction re-introduce some kind of bug? 
> I have been chasing down the places in the compiler where explicit casts to 
> (PyObject *) are made and replacing them with
>  "(%s)" % <target_type>.declaration_code("").


Oooh, this sounds like what I was trying figure out, to track down
some more compiler warnings. Basically, (PyObject *) was being used to
cast an extension type, even when there was an explicit cast to that type.
I'm currently getting around it with a postprocessor on the generated
.c file.

-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke                      http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca



More information about the Pyrex mailing list