After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 640650 - resolve class members lazily on first usage
resolve class members lazily on first usage
Status: RESOLVED OBSOLETE
Product: pygobject
Classification: Bindings
Component: introspection
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks: 693243
 
 
Reported: 2011-01-26 17:01 UTC by Tomeu Vizoso
Modified: 2018-01-10 20:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
work in progress (21.93 KB, patch)
2013-08-23 20:16 UTC, Daniel Drake
reviewed Details | Review

Description Tomeu Vizoso 2011-01-26 17:01:53 UTC
inside __getattr__ because some classes can be very big and only a very small part of the API will be used in typical applications. This will save startup time and memory at the expense of a little more overhead on the first invocation of a method.
Comment 1 Daniel Drake 2013-08-23 20:16:47 UTC
Created attachment 252949 [details] [review]
work in progress

I started to look at this, specifically making method lookup lazy as a first step. Here is a messy patch so far.

It is a bit more complicated than I anticipated. For example, if you don't find the method on your own class, you do need to check parent classes to find it.

super() can no longer be used as it does not trigger __getattr__ to happen, http://stackoverflow.com/questions/12047847/super-object-not-calling-getattr

I haven't quite got my head around the whole bound/unbound method thing yet, and how to deal with that in __getattr__.

Right now I am at the point where this patch causes random crashes, easily exposed by the test suite. Looking with valgrind, bad memory accesses are happening. However that is true even with current master.
Comment 2 Simon Feltman 2013-10-28 22:20:07 UTC
Review of attachment 252949 [details] [review]:

I think this is a good first step. The super() problem is probably a deal breaker but it may be possible to get around this because we control our own versions of bound/unbound methods (GICallableInfo). This might also be related to bug 710646.
Comment 3 Simon Feltman 2014-02-06 03:54:54 UTC
An alternate approach for improving the performance this ticket aims to help would be to move all overrides with deprecated intializers behind a logic statement. The statement could check for enablement of skipping deprecated initalizers as mentioned in bug 723736.
Comment 4 GNOME Infrastructure Team 2018-01-10 20:02:37 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/pygobject/issues/10.