summaryrefslogtreecommitdiff
path: root/engine/SCons/Debug.py
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2015-09-28 18:23:35 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2015-09-28 18:23:35 +0200
commit726a5c6687817cf8694aaa05474c7662b1b19f80 (patch)
treeadb3d5b06eb5e10c991e9c0dd21eb17b46f46189 /engine/SCons/Debug.py
parenta3720dc6ef48bd5f9323a0f772f17b0fb0b29263 (diff)
parent72c39ad485d174c2e8e1fef34b8e9e392a94458a (diff)
Merge tag 'upstream/2.4.0'
Upstream version 2.4.0
Diffstat (limited to 'engine/SCons/Debug.py')
-rw-r--r--engine/SCons/Debug.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/engine/SCons/Debug.py b/engine/SCons/Debug.py
index 8adf7ca..0aa077d 100644
--- a/engine/SCons/Debug.py
+++ b/engine/SCons/Debug.py
@@ -28,12 +28,13 @@ needed by most users.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Debug.py rel_2.3.5:3347:d31d5a4e74b6 2015/07/31 14:36:10 bdbaddog"
+__revision__ = "src/engine/SCons/Debug.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
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))