mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 04:13:22 +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_MAJOR 0
|
||||||
#define PYKD_VERSION_MINOR 2
|
#define PYKD_VERSION_MINOR 2
|
||||||
#define PYKD_VERSION_SUBVERSION 0
|
#define PYKD_VERSION_SUBVERSION 0
|
||||||
#define PYKD_VERSION_BUILDNO 26
|
#define PYKD_VERSION_BUILDNO 27
|
||||||
|
|
||||||
|
|
||||||
#define __VER_STR2__(x) #x
|
#define __VER_STR2__(x) #x
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "dbgexcept.h"
|
||||||
|
|
||||||
namespace pykd {
|
namespace pykd {
|
||||||
|
|
||||||
typedef boost::variant<LONG, ULONG, LONG64, ULONG64, bool> BaseTypeVariant;
|
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 {
|
class intBase {
|
||||||
|
|
||||||
@ -114,12 +121,26 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
python::object eq( python::object& obj ) {
|
python::object eq( python::object& obj ) {
|
||||||
|
|
||||||
|
try {
|
||||||
return boost::apply_visitor( VariantToPyobj(), getValue() ) == obj;
|
return boost::apply_visitor( VariantToPyobj(), getValue() ) == obj;
|
||||||
}
|
}
|
||||||
|
catch( DbgException& )
|
||||||
|
{}
|
||||||
|
|
||||||
|
return python::object(false);
|
||||||
|
}
|
||||||
|
|
||||||
python::object ne( python::object& obj ) {
|
python::object ne( python::object& obj ) {
|
||||||
|
|
||||||
|
try {
|
||||||
return boost::apply_visitor( VariantToPyobj(), getValue() ) != obj;
|
return boost::apply_visitor( VariantToPyobj(), getValue() ) != obj;
|
||||||
}
|
}
|
||||||
|
catch( DbgException& )
|
||||||
|
{}
|
||||||
|
|
||||||
|
return python::object(true);
|
||||||
|
}
|
||||||
|
|
||||||
python::object lt( python::object& obj ) {
|
python::object lt( python::object& obj ) {
|
||||||
return boost::apply_visitor( VariantToPyobj(), getValue() ) < obj;
|
return boost::apply_visitor( VariantToPyobj(), getValue() ) < obj;
|
||||||
|
@ -243,3 +243,10 @@ class TypeInfoTest( unittest.TestCase ):
|
|||||||
def testArrayOf(self):
|
def testArrayOf(self):
|
||||||
ti = pykd.typeInfo("UInt8B").arrayOf(10)
|
ti = pykd.typeInfo("UInt8B").arrayOf(10)
|
||||||
self.assertTrue( "UInt8B[10]", ti.name() )
|
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