Benjamin Peterson schrieb: > A while ago, Guido declared that all special method lookups on > new-style classes bypass __getattr__ and __getattribute__. This almost > completely consistent now, and I've been working on patching up a few > incorrect cases. I've know hit __enter__ and __exit__. The compiler > generates LOAD_ATTR instructions for these, so it uses the normal > lookup. The only way I can see to fix this is add a new opcode which > uses _PyObject_LookupSpecial, but I don't think we really care this > much. Opinions?
It's easier to introduce a separate opcode like SETUP_WITH; the compilation of a with statement produces quite a lot of bytecode which could be made more efficient that way. Georg -- Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the number of spaces thou shalt indent, and the number of thy indenting shall be four. Eight shalt thou not indent, nor either indent thou two, excepting that thou then proceed to four. Tabs are right out. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com