[PATCH] D93117: LNT: Fix Perf profiling support

Thomas Preud'homme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 11 08:27:56 PST 2020


thopre added inline comments.


================
Comment at: lnt/testing/profile/perf.py:15
+        # Python 3
+        import lnt.testing.profile.cPerf as cPerf
+    except Exception:
----------------
tnfchris wrote:
> thopre wrote:
> > tnfchris wrote:
> > > thopre wrote:
> > > > Why did Python2 not require this? Is there some sort of module path set somewhere that does not work for Python3?
> > > from what I understood, C Python code will be created in the same folder as it's defined in and those folder become the module path.
> > > I don't know the semantics of Python 2 as I didn't look at it, but 3 would require the full path or module path set somewhere.
> > > 
> > > I had looked through the configuration and this was not set anywhere so I opted for using the full import.
> > Oh I think it's because Python2 defaults to relative import before full import. I would therefore suggest to use instead:
> > 
> > from . import cPerf
> fancy.. didn't know that, thanks.
FYI: https://docs.python.org/3/reference/import.html#package-relative-imports

There's a PEP somewhere with more details, couldn't find the link in less than 10s so I got lazy.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93117



More information about the llvm-commits mailing list