Skip to content

Commit 44c167a

Browse files
committed
[libcxx] Replace func_name with __name__ for compatibility with Python 3
Summary: The __name__ attribute is the correct way to get a function name in Python 3. This also works with Python 2. Reviewers: jroelofs, EricWF Subscribers: christof, ldionne, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D71136
1 parent f387b99 commit 44c167a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libcxx/utils/libcxx/test/tracing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def trace_function(function, log_calls, log_results, label=''):
1414
def wrapper(*args, **kwargs):
1515
kwarg_strs = ['{}={}'.format(k, v) for (k, v) in kwargs]
1616
arg_str = ', '.join([str(a) for a in args] + kwarg_strs)
17-
call_str = '{}({})'.format(function.func_name, arg_str)
17+
call_str = '{}({})'.format(function.__name__, arg_str)
1818

1919
# Perform the call itself, logging before, after, and anything thrown.
2020
try:
@@ -36,7 +36,7 @@ def trace_object(obj, log_calls, log_results, label=''):
3636
for name, member in inspect.getmembers(obj):
3737
if inspect.ismethod(member):
3838
# Skip meta-functions, decorate everything else
39-
if not member.func_name.startswith('__'):
39+
if not member.__name__.startswith('__'):
4040
setattr(obj, name, trace_function(member, log_calls,
4141
log_results, label))
4242
return obj

0 commit comments

Comments
 (0)