[issue19722] Expose stack effect calculator to Python

Larry Hastings report at bugs.python.org
Fri Nov 22 20:42:03 CET 2013


New submission from Larry Hastings:

Attached is a patch exposing the old opcode_stack_effect() function to Python.  The patch does the following:

* renames opcode_stack_effect() to PyCompile_OpcodeStackEffect()
* removes the "static" modifier from PyCompile_OpcodeStackEffect()
* changes PyCompile_OpcodeStackEffect()'s behavior so it returns a magic
  value on failure
* preserves existing behavior when compiling code and encountering
  an opcode/oparg pair that results in failure
* creates a new _opcode module
* exposes PyCompile_OpcodeStackEffect() as _opcode.stack_effect()
* tests _opcode module with new test__opcode.py
* imports _opcode.stack_effect() into opcode, exposing it publically
* documents the function in dis (there is no documentation for opcode,
  and dis imports and exposes everything in opcode)

Whew!  I think it's ready to go in.

----------
assignee: larry
components: Library (Lib)
files: larry.expose.stack.effect.patch.1.diff
keywords: patch
messages: 203845
nosy: larry, ncoghlan
priority: normal
severity: normal
stage: patch review
status: open
title: Expose stack effect calculator to Python
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file32781/larry.expose.stack.effect.patch.1.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19722>
_______________________________________


More information about the Python-bugs-list mailing list