diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2019-10-17 06:40:23 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-17 06:40:23 -0700 |
commit | cf9de058aaa6bfde635868422b504e4fb1413359 (patch) | |
tree | 5736d8d8da67432902387d720b6fc2b4e454ce18 /etc | |
parent | 93c34039e488937e6803d20316c1d3607869067e (diff) | |
download | spack-cf9de058aaa6bfde635868422b504e4fb1413359.tar.gz spack-cf9de058aaa6bfde635868422b504e4fb1413359.tar.bz2 spack-cf9de058aaa6bfde635868422b504e4fb1413359.tar.xz spack-cf9de058aaa6bfde635868422b504e4fb1413359.zip |
multimethods: avoid calling caller_locals() in Python 3 (#13238)
Python 3 metaclasses have a `__prepare__` method that lets us save the
class's dictionary before it is constructed. In Python 2 we had to walk
up the stack using our `caller_locals()` method to get at this. Using
`__prepare__` is much faster as it doesn't require us to use `inspect`.
This makes multimethods use the faster `__prepare__` method in Python3,
while still using `caller_locals()` in Python 2. We try to reduce the
use of caller locals using caching to speed up Python 2 a little bit.
Diffstat (limited to 'etc')
0 files changed, 0 insertions, 0 deletions