Hello, I’m trying to implement the compilation of __eq__, __ne__, etc. in extension types, to have them available in pure mode (see ticket #130).
I currently have an implementation which basically pastes the body.stats from those six functions in a __richcmp__ one using a template, but I find that very inelegant, as it removes the information about the original location of this code which is very bad for debugging, forces all six (or less) functions to use the same argument names (or rename them), and probably some other issues. So my idea was to convert each of those special function into a CFuncDefNode from a DefNode, in order to remove the Python wrapper, then to implement the new tp_richcmp slot as an util function directly in C. If this plan is sound, I’d like a few more informations, for now mostly about the DefNode to CFuncDefNode conversion, which I’ve been unable to do programmatically, with some later passes complaining about missing base_type or declarator properties. The next question is about determining in the C code whether a specific method exists, and otherwise returning NotImplemented instead. Thanks for listening, I’m not sure I’ve been very understandable, I’m still quite confused. ^^' -- Emmanuel Gil Peyrot
signature.asc
Description: PGP signature
_______________________________________________ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel