diff --git a/lnt/testing/profile/cPerf.cpp b/lnt/testing/profile/cPerf.cpp --- a/lnt/testing/profile/cPerf.cpp +++ b/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 diff --git a/lnt/testing/profile/perf.py b/lnt/testing/profile/perf.py --- a/lnt/testing/profile/perf.py +++ b/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):