Commit 6b36fbe9 authored by Simon Feltman's avatar Simon Feltman
Browse files

Remove redundant info.get_name calls

Remove a number of redundant calls to GIBaseInfo.get_name. Info
names are already cached on function objects so re-use them when
possible. This gives a small load time improvement by removing over
2000 calls when importing Gtk.
parent 6fdde256
......@@ -208,7 +208,6 @@ class IntrospectionModule(object):
self.__dict__[name] = type_
return type_
name = info.get_name()
dict_ = {
'__info__': info,
'__module__': 'gi.repository.' + self._namespace,
......@@ -95,13 +95,11 @@ class MetaClassHelper(object):
def _setup_constructors(cls):
for method_info in cls.__info__.get_methods():
if method_info.is_constructor():
name = method_info.get_name()
constructor = classmethod(Constructor(method_info))
setattr(cls, name, constructor)
constructor = Constructor(method_info)
setattr(cls, constructor.__name__, classmethod(constructor))
def _setup_methods(cls):
for method_info in cls.__info__.get_methods():
name = method_info.get_name()
function = Function(method_info)
if method_info.is_method():
method = function
......@@ -109,7 +107,7 @@ class MetaClassHelper(object):
method = staticmethod(function)
setattr(cls, name, method)
setattr(cls, function.__name__, method)
def _setup_fields(cls):
for field_info in cls.__info__.get_fields():
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment