aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-10-31 16:19:39 -0400
committerJesse Luehrs <doy@tozt.net>2014-10-31 16:19:39 -0400
commitbc9b7364b4ed60152d360e074fb686e31db58ca7 (patch)
treeb44f4be28fa6ccfd781314641e03df0bc9a7c8be
parent59cbb7fc0211d2b74008540e5f53dbce606fbd67 (diff)
downloadpython-mop-bc9b7364b4ed60152d360e074fb686e31db58ca7.tar.gz
python-mop-bc9b7364b4ed60152d360e074fb686e31db58ca7.zip
looks like we do need a separate finalize step
otherwise inheritance doesn't work, because there's no point at which we can really initialize the backing vtable for the ancestor class methods
-rw-r--r--mop/__init__.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/mop/__init__.py b/mop/__init__.py
index c07b12e..b2bf41c 100644
--- a/mop/__init__.py
+++ b/mop/__init__.py
@@ -265,6 +265,13 @@ def bootstrap():
name="base_object_class", body=lambda self: Object
))
+ def finalize(self):
+ for method in self.get_all_methods().values():
+ python_install_method(self, method.get_name(), method)
+ Class.add_method(Method.new(
+ name="finalize", body=finalize
+ ))
+
def isa(self, other):
mro = self.metaclass.get_mro()
return other in mro
@@ -292,9 +299,7 @@ def bootstrap():
python_install_method(Attribute, method.get_name(), method)
def add_method(self, method):
- name = method.get_name()
- self.get_local_methods()[name] = method
- python_install_method(self, name, method)
+ self.get_local_methods()[method.get_name()] = method
Class.add_method(Method.new(
name="add_method", body=add_method
))