Changeset 69573 in vbox
- Timestamp:
- Nov 4, 2017 8:52:52 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/common/utils.py
r69547 r69573 1597 1597 1598 1598 1599 def getObjectTypeName(oObject): 1600 """ 1601 Get the type name of the given object. 1602 """ 1603 if oObject is None: 1604 return 'None'; 1605 1606 # Get the type object. 1607 try: 1608 oType = type(oObject); 1609 except: 1610 return 'type-throws-exception'; 1611 1612 # Python 2.x only: Handle old-style object wrappers. 1613 if sys.version_info[0] < 3: 1614 try: 1615 from types import InstanceType; 1616 if oType == InstanceType: 1617 oType = oObject.__class__; 1618 except: 1619 pass; 1620 1621 # Get the name. 1622 try: 1623 return oType.__name__; 1624 except: 1625 return '__type__-throws-exception'; 1626 1627 1599 1628 # 1600 1629 # TestSuite stuff.
Note:
See TracChangeset
for help on using the changeset viewer.