From bf5e335269f22d238061ae139e0f10d203486cb4 Mon Sep 17 00:00:00 2001 From: mio Date: Sat, 15 Feb 2025 20:50:20 +0800 Subject: [PATCH] Remove types for __deprecated as ParamSpec not available on Py3.8 --- bindings/python/unicorn/unicorn_py3/unicorn.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/bindings/python/unicorn/unicorn_py3/unicorn.py b/bindings/python/unicorn/unicorn_py3/unicorn.py index be68d3fc..085fb113 100644 --- a/bindings/python/unicorn/unicorn_py3/unicorn.py +++ b/bindings/python/unicorn/unicorn_py3/unicorn.py @@ -3,7 +3,7 @@ based on Nguyen Anh Quynnh's work """ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Callable, Dict, Generic, Iterable, Iterator, Optional, Sequence, Tuple, Type, TypeVar, Union, ParamSpec +from typing import TYPE_CHECKING, Any, Callable, Dict, Generic, Iterable, Iterator, Optional, Sequence, Tuple, Type, TypeVar, Union import ctypes import functools @@ -636,14 +636,12 @@ class Uc(RegStateManager): # https://stackoverflow.com/questions/2536307/decorators-in-the-python-standard-lib-deprecated-specifically @staticmethod def __deprecated(msg: str): - __rT = TypeVar('rT') # return type - __pT = ParamSpec('pT') # parameters type - def __deprecated_inner(func: Callable[__pT, __rT]) -> Callable[__pT, __rT]: + def __deprecated_inner(func: Callable) -> Callable: """Use this decorator to mark functions as deprecated. Every time the decorated function runs, it will emit a "deprecation" warning.""" @functools.wraps(func) - def new_func(*args: __pT.args, **kwargs: __pT.kwargs): + def new_func(*args, **kwargs): warnings.simplefilter('always', DeprecationWarning) # turn off filter warnings.warn("Call to a deprecated function {}. {}".format(func.__name__, msg), category=DeprecationWarning,