Method Resolution Order (MRO) is not compliant
uPy currently implements depth-first MRO, which is equivalent to one used pre-Python2.2.
References:
- http://python-history.blogspot.com/2010/06/method-resolution-order.html
- https://www.python.org/download/releases/2.3/mro/
RFC/WIP py/objtype: user classes: Allow to lookup __new__() method.
new() method is present by definition in each class, because each class
inherits from "object". But due to effects of multiple inheritance and
subclassing native types, looking it up is tricky: object.new should
be the last choice, if a more specific version is found (in one of multiple
bases, or in native type), that should be used.
This patch implements this behavior by wrapping existing attribute lookup
function, and looking inside "object" only if the otiginal function doesn't
find anything. This relies on "object" not being present explicitly in the
base class chain (otherwise multiple inheritance case will be broken -
object.new will be found while following the very first inheritance
branch, while other branches may have more specific new).
This also leads to additional stack usage on each lookup due to extra
function call.