mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 03:23:23 +08:00
[0.2.x] fixed : issue #12599 (exception raised when comparing typeInfo with None )
git-svn-id: https://pykd.svn.codeplex.com/svn@86901 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
ae1e83e9d5
commit
9ac635b5d3
@ -2,7 +2,7 @@
|
||||
#define PYKD_VERSION_MAJOR 0
|
||||
#define PYKD_VERSION_MINOR 2
|
||||
#define PYKD_VERSION_SUBVERSION 0
|
||||
#define PYKD_VERSION_BUILDNO 26
|
||||
#define PYKD_VERSION_BUILDNO 27
|
||||
|
||||
|
||||
#define __VER_STR2__(x) #x
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "dbgexcept.h"
|
||||
|
||||
namespace pykd {
|
||||
|
||||
typedef boost::variant<LONG, ULONG, LONG64, ULONG64, bool> BaseTypeVariant;
|
||||
@ -81,6 +83,11 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
inline bool isConvertable( python::object& obj )
|
||||
{
|
||||
return PyInt_Check(obj.ptr()) || PyLong_Check(obj.ptr()) || PyBool_Check(obj.ptr());
|
||||
}
|
||||
|
||||
|
||||
class intBase {
|
||||
|
||||
@ -114,11 +121,25 @@ public:
|
||||
}
|
||||
|
||||
python::object eq( python::object& obj ) {
|
||||
return boost::apply_visitor( VariantToPyobj(), getValue() ) == obj;
|
||||
|
||||
try {
|
||||
return boost::apply_visitor( VariantToPyobj(), getValue() ) == obj;
|
||||
}
|
||||
catch( DbgException& )
|
||||
{}
|
||||
|
||||
return python::object(false);
|
||||
}
|
||||
|
||||
python::object ne( python::object& obj ) {
|
||||
return boost::apply_visitor( VariantToPyobj(), getValue() ) != obj;
|
||||
|
||||
try {
|
||||
return boost::apply_visitor( VariantToPyobj(), getValue() ) != obj;
|
||||
}
|
||||
catch( DbgException& )
|
||||
{}
|
||||
|
||||
return python::object(true);
|
||||
}
|
||||
|
||||
python::object lt( python::object& obj ) {
|
||||
|
@ -243,3 +243,10 @@ class TypeInfoTest( unittest.TestCase ):
|
||||
def testArrayOf(self):
|
||||
ti = pykd.typeInfo("UInt8B").arrayOf(10)
|
||||
self.assertTrue( "UInt8B[10]", ti.name() )
|
||||
|
||||
def testCompareWihNone(self):
|
||||
ti = None
|
||||
if ti == None:
|
||||
ti = pykd.typeInfo("UInt8B")
|
||||
if ti == None:
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user