diff options
author | Jeffrey Yasskin <jyasskin@gmail.com> | 2009-05-08 21:51:06 (GMT) |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@gmail.com> | 2009-05-08 21:51:06 (GMT) |
commit | 1aa4700234aa0657ee8cb12cfd9b615fef9e0300 (patch) | |
tree | 6a480c31e4b83218ae9412f7ab2e9d41b34f8fd0 /Include | |
parent | 083d1f9f9a26486cf9f0d85fb0e76e6cf9474b0c (diff) | |
download | cpython-1aa4700234aa0657ee8cb12cfd9b615fef9e0300.zip cpython-1aa4700234aa0657ee8cb12cfd9b615fef9e0300.tar.gz cpython-1aa4700234aa0657ee8cb12cfd9b615fef9e0300.tar.bz2 |
PyCode_NewEmpty:
Most uses of PyCode_New found by http://www.google.com/codesearch?q=PyCode_New
are trying to build an empty code object, usually to put it in a dummy frame
object. This patch adds a PyCode_NewEmpty wrapper which lets the user specify
just the filename, function name, and first line number, instead of also
requiring lots of code internals.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/code.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Include/code.h b/Include/code.h index 8c00700..0167ad4 100644 --- a/Include/code.h +++ b/Include/code.h @@ -70,6 +70,11 @@ PyAPI_FUNC(PyCodeObject *) PyCode_New( int, int, int, int, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *); /* same as struct above */ + +/* Creates a new empty code object with the specified source location. */ +PyAPI_FUNC(PyCodeObject *) +PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno); + PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int); /* for internal use only */ |