From 670659121bcbd84aaeb092ccb63d5b8cf470440c Mon Sep 17 00:00:00 2001 From: "SND\\kernelnet_cp" Date: Thu, 29 Dec 2011 14:25:17 +0000 Subject: [PATCH] [0.1.x] fixed : typedVar can not be used as a key for map git-svn-id: https://pykd.svn.codeplex.com/svn@72761 9b283d60-5439-405e-af05-b73fd8c4d996 --- pykd/dbgext.cpp | 3 ++- test/scripts/typedvar.py | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/pykd/dbgext.cpp b/pykd/dbgext.cpp index 34a9035..f3a4e2f 100644 --- a/pykd/dbgext.cpp +++ b/pykd/dbgext.cpp @@ -133,7 +133,8 @@ BOOST_PYTHON_MODULE( pykd ) .def( "__hex__", &intBase::hex ) .def( "__long__", &intBase::long_ ) .def( "__int__", &intBase::int_ ) - .def( "__index__", &intBase::long_ ); + .def( "__index__", &intBase::long_ ) + .def( "__hash__", &intBase::long_ ); python::class_("dbgClient", "Class representing a debugging session", python::no_init ) .def( "addr64", &DebugClient::addr64, diff --git a/test/scripts/typedvar.py b/test/scripts/typedvar.py index a69ded7..c4ac613 100644 --- a/test/scripts/typedvar.py +++ b/test/scripts/typedvar.py @@ -130,6 +130,16 @@ class TypedVarTest( unittest.TestCase ): ind = target.module.typedVar( "g_ucharValue" ) self.assertEqual( 5, [0,5,10][ind] ) + + self.assertTrue( ind in [0,1,2] ) tv = target.module.typedVar( "g_struct3" ) self.assertEqual( 2, tv.m_arrayField[ind] ) + + ind = target.module.typedVar( "g_ulongValue" ) + self.assertEqual( 4, ind ) + self.assertTrue( ind in { 1 : "1", 4 : "2" } ) + self.assertEqual( "2", { 1 : "1", 4 : "2" }[ind] ) + + +