[Cython] Treatment of right-hand side after assignment

Clemens Hofreither chofreither at gmail.com
Sun Apr 2 12:42:57 EDT 2017


Hey all,

(I hope this list isn't dead.)

I'm reading up on the Cython codebase because I'm trying to implement
a small feature (more on that later). There's one thing that really
confuses me currently, and that's the distinction between
generate_post_assignment_code and generate_disposal_code. From the
comments, it appears that exactly one of these should be called, and
which one it is depends on whether a reference from the rhs was
absorbed into the lhs.

So much for the theory, but in practice it seems to work differently.
I'm looking at NameNode.generate_assignment_code() and
IndexNode.generate_assignment_code(), which should do similar things
(generate code for an assignment) except that the lhs has different
structure.

Yet they treat the cleanup of the rhs completely differently.
IndexNode always calls rhs.generate_disposal_code. NameNode almost
always calls rhs.generate_post_assignment_code.

Can anyone shed light on why this cleanup is handled differently
depending on the target of the assignment?

Thanks,
Clemens


More information about the cython-devel mailing list