Maintain backward compatibility with Python < 3.10

pull/965/head
novafacing 4 years ago committed by Disconnect3d
parent 07b7c754cd
commit 44394463e0

@ -6,7 +6,6 @@ e.g. execution stops because of a SIGINT or breakpoint, or a
new library/objfile are loaded, etc.
"""
import collections
import functools
import sys
@ -14,6 +13,13 @@ import gdb
import pwndbg.events
try:
# Python >= 3.10
from collections.abc import Hashable
except ImportError:
# Python < 3.10
from collections import Hashable
debug = False
@ -32,7 +38,7 @@ class memoize:
def __call__(self, *args, **kwargs):
how = None
if not isinstance(args, collections.abc.Hashable):
if not isinstance(args, Hashable):
print("Cannot memoize %r!", file=sys.stderr)
how = "Not memoizeable!"
value = self.func(*args)

Loading…
Cancel
Save