gi: handle deprecated attributes in OverridesProxyModule directly
This avoids the need for per-module subclasses or using descriptors to handle each deprecation, simplifying the logic a bit.
Instead, we have OverridesProxyModule.__getattr__
warn about and return deprecated attributes, and add a __delattr__
method to handle deletion. The default __setattr__
method is fine as is, potentially shadowing deprecated attributes.
There are some visible behavioural changes here:
-
dir(module)
no longer returns class attributes of the module type. This is because I'm relying onsuper().__dir__()
to list the attributes of the proxy module. Deprecated attributes are still there because they are added explicitly. - Previously something like
del GLib.ascii_strdown
would fail with an AttributeError. It now succeeds, forwarding the delattr call toGLib._introspection_module
. The attribute doesn't stay permanently deleted though, due to the lazy loading behaviour ofIntrospectionModule
.
It seems unlikely that this is unlikely to break existing users. Everything that should appear in help(module)
still seems to be there.