diff options
| author | Dirk Baechle <dl9obn@darc.de> | 2015-08-06 17:14:50 (GMT) |
|---|---|---|
| committer | Dirk Baechle <dl9obn@darc.de> | 2015-08-06 17:14:50 (GMT) |
| commit | f1dbc3edd79cfbc80e469377bf8d45624cc04d40 (patch) | |
| tree | 819103cc2938aec5231da4cd07eac71ea6d90c06 /src/engine/SCons/Debug.py | |
| parent | 1787f2cb6c75f45c6b0ac7a6c3c9c4b0ea95c5eb (diff) | |
| parent | 2dd443706e2c6a2f85e9ac40a237fc2c73aab345 (diff) | |
| download | SCons-f1dbc3edd79cfbc80e469377bf8d45624cc04d40.zip SCons-f1dbc3edd79cfbc80e469377bf8d45624cc04d40.tar.gz SCons-f1dbc3edd79cfbc80e469377bf8d45624cc04d40.tar.bz2 | |
Merged in dirkbaechle/scons : switch of core classes to slots, memoizer subsystem now uses decorators
Diffstat (limited to 'src/engine/SCons/Debug.py')
| -rw-r--r-- | src/engine/SCons/Debug.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/engine/SCons/Debug.py b/src/engine/SCons/Debug.py index 9974039..b47c24c 100644 --- a/src/engine/SCons/Debug.py +++ b/src/engine/SCons/Debug.py @@ -34,6 +34,7 @@ import os import sys import time import weakref +import inspect # Global variable that gets set to 'True' by the Main script, # when the creation of class instances should get tracked. @@ -46,7 +47,12 @@ def logInstanceCreation(instance, name=None): name = instance.__class__.__name__ if name not in tracked_classes: tracked_classes[name] = [] - tracked_classes[name].append(weakref.ref(instance)) + if hasattr(instance, '__dict__'): + tracked_classes[name].append(weakref.ref(instance)) + else: + # weakref doesn't seem to work when the instance + # contains only slots... + tracked_classes[name].append(instance) def string_to_classes(s): if s == '*': @@ -66,7 +72,10 @@ def listLoggedInstances(classes, file=sys.stdout): for classname in string_to_classes(classes): file.write('\n%s:\n' % classname) for ref in tracked_classes[classname]: - obj = ref() + if inspect.isclass(ref): + obj = ref() + else: + obj = ref if obj is not None: file.write(' %s\n' % repr(obj)) |
