From 8056413701362e2aad07215f48e9db3b453bcb75 Mon Sep 17 00:00:00 2001 From: Johannes Blaschke Date: Sun, 10 Jan 2021 14:00:25 -0800 Subject: [PATCH] tweak the annotate wrapper to preserve the function call signature --- PyNVTX/__init__.py | 8 +++++--- setup.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/PyNVTX/__init__.py b/PyNVTX/__init__.py index d25c04e..7e7bbcb 100644 --- a/PyNVTX/__init__.py +++ b/PyNVTX/__init__.py @@ -3,6 +3,7 @@ from functools import wraps +from inspect import signature from PyNVTX_backend import * from .singleton import Singleton @@ -11,7 +12,7 @@ major_version = 0; minor_version = 3; -release_version = 0; +release_version = 1; NVTX_IDENTIFIER = "NVTX" REGISTRY = Registry() @@ -21,12 +22,13 @@ def annotate(label): def _annotate(func): @wraps(func) - def wrapped(*args, **kwargs): + def wrapper(*args, **kwargs): RangePushA(label) ret = func(*args, **kwargs) RangePop() return ret - return wrapped + wrapper.__signature__ = signature(func) + return wrapper return _annotate diff --git a/setup.py b/setup.py index 1716556..9448cb0 100644 --- a/setup.py +++ b/setup.py @@ -180,7 +180,7 @@ def build_extensions(self): setup( name="PyNVTX", - version="0.3.0", + version="0.3.1", author="Johannes Blaschke", author_email="johannes@blaschke.science", description="A thin python wrapper for the nvToolsExt (NVTX) library, using pybind11 ... with some bells and whistles thrown in for good measure.",