Nick Coghlan <ncogh...@gmail.com> added the comment:
I stumbled across this independently in bpo-44596, but missed this existing report due to the specific word I was looking for (encapsulation). In addition to the comparison operand coercion, there's now another access option through the `__ror__` method. The bug in both cases arises from delegating a method/function implementation to the underlying mapping type in a way that invokes the full operand coercion dance. (PyObject_RichCompare in one case, PyNumber_Or in the other) Delegating these operations to the underlying mapping does make sense, but it needs to be a lower level delegation that bypasses the operand coercion dance, so the other operand only ever sees the proxy object, not the underlying mapping. ---------- nosy: +ncoghlan _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue43838> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com