Changeset 69554 in vbox
- Timestamp:
- Nov 2, 2017 3:26:26 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testdriver/vbox.py
r69543 r69554 1430 1430 if not self.fImportedVBoxApi: 1431 1431 return True; 1432 import gc; 1432 1433 1433 1434 self.aoRemoteSessions = []; … … 1439 1440 1440 1441 try: 1441 import gc1442 1442 gc.collect(); 1443 objects = gc.get_objects()1443 aObjects = gc.get_objects(); 1444 1444 try: 1445 try: 1446 from types import InstanceType 1447 except ImportError: 1448 InstanceType = None # Python 3.x compatibility 1449 for o in objects: 1450 objtype = type(o) 1451 if objtype == InstanceType: # Python 2.x codepath 1452 objtype = o.__class__ 1453 if objtype.__name__ == 'VirtualBoxManager': 1445 try: from types import InstanceType; # For old-style python 2.x objects, not in python 3. 1446 except ImportError: InstanceType = None; 1447 for oObj in aObjects: 1448 oObjType = type(oObj) 1449 if oObjType == InstanceType: # Python 2.x codepath 1450 oObjType = oObj.__class__ 1451 if oObjType.__name__ == 'VirtualBoxManager': 1454 1452 reporter.log('actionCleanupAfter: CAUTION, there is still a VirtualBoxManager object, GC trouble') 1455 1453 break 1456 1454 finally: 1457 del objects1455 del aObjects; 1458 1456 except: 1459 1457 reporter.logXcpt(); … … 1462 1460 1463 1461 if self.sHost == 'win': 1464 pass; ## TODO shutdown COM if possible/necessary? 1462 try: 1463 import pythoncom; # pylint: disable=F0401 1464 cIfs = pythoncom._GetInterfaceCount(); # pylint: disable=no-member,protected-access 1465 cObjs = pythoncom._GetGatewayCount(); # pylint: disable=no-member,protected-access 1466 if cObjs == 0 and cIfs == 0: 1467 reporter.log('actionCleanupAfter: no interfaces or objects left behind.'); 1468 else: 1469 reporter.log('actionCleanupAfter: Python COM still has %s objects and %s interfaces...' % ( cObjs, cIfs)); 1470 from win32com.client import DispatchBaseClass; 1471 for oObj in gc.get_objects(): 1472 if isinstance(oObj, DispatchBaseClass): 1473 reporter.log('actionCleanupAfter: %s' % (oObj,)); 1474 oObj = None; 1475 except: 1476 reporter.logXcpt(); 1465 1477 else: 1466 1478 try:
Note:
See TracChangeset
for help on using the changeset viewer.