[Pyrex] Another lvalue cast bites the dust

Lenard Lindstrom len-l at telus.net
Thu Oct 20 05:26:52 CEST 2005


On 20 Oct 2005 at 13:03, Greg Ewing wrote:

> Lenard Lindstrom wrote:
> 
> > I think there are only a few places where lvalue casts can appear. So 
> > I will check them and make any necessary fixes.
> 
> Be careful while you're doing that. The reason some
> of the lvalue casts appear is that in some places
> I'm using the same methods to generate code for an
> expression whether it appears on the left or the
> right. So you need to take care that you're not
> also affecting necessary casts on the rhs.

Thanks for the warning. I am aware of it though since I have been 
dealing with extension types, which automatically add that (PyObject 
*) cast. I don't play with the node results, just which version is 
used at any particular place when there is a choice.

What I am guessing is that the most likely problem points are where 
assignments occur in a Pyrex program: to a name, to an attribute,  to 
an index, to a function argument and to a function return value. 
Problems arise when lvalues have extenion type types. These are also 
the places where I have concentrated my effort to add the necessary 
casts for C++. Of course there may be some overlooked places in the 
stock code generators for things like type checking and argument 
extraction. But I am sure that has already been looked over quite 
carefully. This code also almost exclusively involves PyObject * 
temporary variables.

Lenard Lindstrom
<len-l at telus.net>




More information about the Pyrex mailing list