From 478ef9567ee9ce3255b829bcfb57272f2b5ced8c Mon Sep 17 00:00:00 2001 From: Isaac Date: Tue, 18 Oct 2016 08:44:07 +0800 Subject: [PATCH] make metaclass syntax in inthook.py compatible with Python 3 (#128) --- pwndbg/inthook.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pwndbg/inthook.py b/pwndbg/inthook.py index 47352840c..9bbd55974 100644 --- a/pwndbg/inthook.py +++ b/pwndbg/inthook.py @@ -13,6 +13,7 @@ from __future__ import unicode_literals import sys import gdb +from future.utils import with_metaclass import pwndbg.typeinfo @@ -28,8 +29,7 @@ class IsAnInt(type): def __instancecheck__(self, other): return isinstance(other, _int) -class xint(builtins.int): - __metaclass__ = IsAnInt +class xint(with_metaclass(IsAnInt, builtins.int)): def __new__(cls, value, *a, **kw): if isinstance(value, gdb.Value): if pwndbg.typeinfo.is_pointer(value): @@ -44,4 +44,3 @@ globals()['int'] = xint if sys.version_info >= (3,0): builtins.long = xint globals()['long'] = xint -