Mercurial > cpython-lru_cache-weakref
diff Lib/opcode.py @ 87465:5fe72b9ed48e
Issue #19722: Added opcode.stack_effect(), which accurately
computes the stack effect of bytecode instructions.
| author | Larry Hastings <larry@hastings.org> |
|---|---|
| date | Sat, 23 Nov 2013 14:49:22 -0800 |
| parents | 6db3741e59be |
| children |
line wrap: on
line diff
--- a/Lib/opcode.py Sat Nov 23 23:05:27 2013 +0100 +++ b/Lib/opcode.py Sat Nov 23 14:49:22 2013 -0800 @@ -8,6 +8,19 @@ "haslocal", "hascompare", "hasfree", "opname", "opmap", "HAVE_ARGUMENT", "EXTENDED_ARG", "hasnargs"] +# It's a chicken-and-egg I'm afraid: +# We're imported before _opcode's made. +# With exception unheeded +# (stack_effect is not needed) +# Both our chickens and eggs are allayed. +# --Larry Hastings, 2013/11/23 + +try: + from _opcode import stack_effect + __all__.append('stack_effect') +except ImportError: + pass + cmp_op = ('<', '<=', '==', '!=', '>', '>=', 'in', 'not in', 'is', 'is not', 'exception match', 'BAD')
