mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 03:23:23 +08:00
[0.2.x] fixed : issue #12335 ( TypeError: object has no len() for array )
git-svn-id: https://pykd.svn.codeplex.com/svn@85918 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
cf6eea3f78
commit
5cb3fc858b
@ -203,7 +203,7 @@ public:
|
|||||||
throw PyException( PyExc_TypeError, "object has no len()" );
|
throw PyException( PyExc_TypeError, "object has no len()" );
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual python::tuple getElementByIndex( ULONG index ) {
|
virtual python::object getElementByIndex( ULONG index ) {
|
||||||
throw PyException( PyExc_TypeError, "object is unsubscriptable");
|
throw PyException( PyExc_TypeError, "object is unsubscriptable");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,7 +400,7 @@ protected:
|
|||||||
return getFieldCount();
|
return getFieldCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual python::tuple getElementByIndex( ULONG index ) {
|
virtual python::object getElementByIndex( ULONG index ) {
|
||||||
return python::make_tuple( getFieldNameByIndex(index), getFieldByIndex(index) );
|
return python::make_tuple( getFieldNameByIndex(index), getFieldByIndex(index) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -542,6 +542,14 @@ protected:
|
|||||||
return getSize();
|
return getSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual ULONG getElementCount() {
|
||||||
|
return getFieldCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual python::object getElementByIndex( ULONG index ) {
|
||||||
|
return python::make_tuple( getFieldNameByIndex(index), getFieldByIndex(index) );
|
||||||
|
}
|
||||||
|
|
||||||
SymbolPtr m_dia;
|
SymbolPtr m_dia;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -630,6 +638,16 @@ public:
|
|||||||
return m_count;
|
return m_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual ULONG getElementCount() {
|
||||||
|
return getCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual python::object getElementByIndex( ULONG index ) {
|
||||||
|
if( index < m_count )
|
||||||
|
return python::object( m_derefType );
|
||||||
|
throw PyException( PyExc_IndexError, "index out of range" );
|
||||||
|
}
|
||||||
|
|
||||||
virtual TypeInfoPtr getElementType() {
|
virtual TypeInfoPtr getElementType() {
|
||||||
return m_derefType;
|
return m_derefType;
|
||||||
}
|
}
|
||||||
|
@ -213,6 +213,19 @@ class TypeInfoTest( unittest.TestCase ):
|
|||||||
self.assertEqual( 5, len(ti) )
|
self.assertEqual( 5, len(ti) )
|
||||||
for field in ti:
|
for field in ti:
|
||||||
str( field )
|
str( field )
|
||||||
|
|
||||||
|
def testArraySubscribe(self):
|
||||||
|
ti = pykd.typeInfo("g_testArray")
|
||||||
|
self.assertEqual(2, len(ti) )
|
||||||
|
for field in ti:
|
||||||
|
str( field )
|
||||||
|
|
||||||
|
def testEnumSubscribe(self):
|
||||||
|
ti = pykd.typeInfo("enumType")
|
||||||
|
self.assertEqual(3, len(ti) )
|
||||||
|
self.assertEqual( ( "TWO", 2 ), ti[1] )
|
||||||
|
for field in ti:
|
||||||
|
str( field )
|
||||||
|
|
||||||
def testStructNullSize(self):
|
def testStructNullSize(self):
|
||||||
ti = target.module.type("structNullSize")
|
ti = target.module.type("structNullSize")
|
||||||
|
Loading…
Reference in New Issue
Block a user