[Pyrex] Another lvalue cast bites the dust
greg.ewing at canterbury.ac.nz
Wed Oct 19 01:33:56 CEST 2005
Thinking about the ArrayType return value problem,
I'm beginning to wonder whether it would be better
to have Pyrex declare *all* Python-valued variables,
parameters and return values as PyObject *, and cast
to an extension type only when accessing an attribute.
This would be more in keeping with the conventions
used in other Python extension code, and may lead to
fewer problems of the above type. Also, I suspect it
would eliminate most of the situations where lvalue
casting is currently used.
I actually had Pyrex doing things that way at one
time, and I changed it because the extra casting
being done was making the generated code very verbose,
and hard to verify for correctness due to bypassing
almost all of C's type checking.
While you're experimenting, you might like to consider
trying such a scheme and seeing if it simplifies anything.
More information about the Pyrex