[PATCH] D93117: LNT: Fix Perf profiling support

Tamar Christina via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 11 08:33:01 PST 2020


tnfchris updated this revision to Diff 311234.
tnfchris added a comment.

use package relative import syntax


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93117/new/

https://reviews.llvm.org/D93117

Files:
  lnt/testing/profile/cPerf.cpp
  lnt/testing/profile/perf.py


Index: lnt/testing/profile/perf.py
===================================================================
--- lnt/testing/profile/perf.py
+++ lnt/testing/profile/perf.py
@@ -7,9 +7,14 @@
 import traceback
 
 try:
+    # Python 2
     import cPerf
 except Exception:
-    pass
+    try:
+        # Python 3
+        from . import cPerf
+    except Exception:
+        pass
 
 
 class LinuxPerfProfile(ProfileImpl):
Index: lnt/testing/profile/cPerf.cpp
===================================================================
--- lnt/testing/profile/cPerf.cpp
+++ lnt/testing/profile/cPerf.cpp
@@ -824,13 +824,15 @@
                                      nullptr};
 #endif
 
-PyMODINIT_FUNC initcPerf(void) {
 #if PY_MAJOR_VERSION >= 3
+PyMODINIT_FUNC PyInit_cPerf(void) {
   return PyModule_Create(&cPerfModuleDef);
+}
 #else
+PyMODINIT_FUNC initcPerf(void) {
   (void)Py_InitModule("cPerf", cPerfMethods);
-#endif
 }
+#endif
 
 #else // STANDALONE
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93117.311234.patch
Type: text/x-patch
Size: 941 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201211/0cd7c18c/attachment.bin>


More information about the llvm-commits mailing list