Skip to content

Commit

Permalink
tweak the annotate wrapper to preserve the function call signature
Browse files Browse the repository at this point in the history
  • Loading branch information
JBlaschke committed Jan 10, 2021
1 parent f36b3f1 commit 8056413
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions PyNVTX/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@


from functools import wraps
from inspect import signature

from PyNVTX_backend import *
from .singleton import Singleton
Expand All @@ -11,7 +12,7 @@

major_version = 0;
minor_version = 3;
release_version = 0;
release_version = 1;

NVTX_IDENTIFIER = "NVTX"
REGISTRY = Registry()
Expand All @@ -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


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def build_extensions(self):

setup(
name="PyNVTX",
version="0.3.0",
version="0.3.1",
author="Johannes Blaschke",
author_email="[email protected]",
description="A thin python wrapper for the nvToolsExt (NVTX) library, using pybind11 ... with some bells and whistles thrown in for good measure.",
Expand Down

0 comments on commit 8056413

Please sign in to comment.