diff Include/code.h @ 53930:a171048daf76 legacy-trunk

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.
author Jeffrey Yasskin <jyasskin@gmail.com>
date Fri, 08 May 2009 21:51:06 +0000
parents c78d3586c474
children 9ef683d41c9b
line wrap: on
line diff
--- a/Include/code.h	Fri May 08 20:58:08 2009 +0000
+++ b/Include/code.h	Fri May 08 21:51:06 2009 +0000
@@ -70,6 +70,11 @@
 	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 */