[libcxx-commits] [libcxx] 44c167a - [libcxx] Replace func_name with __name__ for compatibility with Python 3
Sergej Jaskiewicz via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Dec 10 15:37:35 PST 2019
Author: Sergej Jaskiewicz
Date: 2019-12-11T02:37:13+03:00
New Revision: 44c167ace998b41b7f8cbe6acd283c8ba9b0b5a3
URL: https://github.com/llvm/llvm-project/commit/44c167ace998b41b7f8cbe6acd283c8ba9b0b5a3
DIFF: https://github.com/llvm/llvm-project/commit/44c167ace998b41b7f8cbe6acd283c8ba9b0b5a3.diff
LOG: [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
Added:
Modified:
libcxx/utils/libcxx/test/tracing.py
Removed:
################################################################################
diff --git a/libcxx/utils/libcxx/test/tracing.py b/libcxx/utils/libcxx/test/tracing.py
index 9ef9ae350522..0bd339273b68 100644
--- a/libcxx/utils/libcxx/test/tracing.py
+++ b/libcxx/utils/libcxx/test/tracing.py
@@ -14,7 +14,7 @@ def trace_function(function, log_calls, log_results, label=''):
def wrapper(*args, **kwargs):
kwarg_strs = ['{}={}'.format(k, v) for (k, v) in kwargs]
arg_str = ', '.join([str(a) for a in args] + kwarg_strs)
- call_str = '{}({})'.format(function.func_name, arg_str)
+ call_str = '{}({})'.format(function.__name__, arg_str)
# Perform the call itself, logging before, after, and anything thrown.
try:
@@ -36,7 +36,7 @@ def trace_object(obj, log_calls, log_results, label=''):
for name, member in inspect.getmembers(obj):
if inspect.ismethod(member):
# Skip meta-functions, decorate everything else
- if not member.func_name.startswith('__'):
+ if not member.__name__.startswith('__'):
setattr(obj, name, trace_function(member, log_calls,
log_results, label))
return obj
More information about the libcxx-commits
mailing list