summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-10-07 19:42:25 (GMT)
committerGuido van Rossum <guido@python.org>1998-10-07 19:42:25 (GMT)
commitd076c73cc81a974794c9aa7e812931b74d6e03c2 (patch)
tree55b5c7b6c145d5491c2dd63780c9654c51aa2306 /Include
parent437ff8600a2959e87194f1491ba99116d73ea543 (diff)
downloadcpython-d076c73cc81a974794c9aa7e812931b74d6e03c2.zip
cpython-d076c73cc81a974794c9aa7e812931b74d6e03c2.tar.gz
cpython-d076c73cc81a974794c9aa7e812931b74d6e03c2.tar.bz2
Changes to support other object types besides strings
as the code string of code objects, as long as they support the (readonly) buffer interface. By Greg Stein.
Diffstat (limited to 'Include')
-rw-r--r--Include/compile.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/Include/compile.h b/Include/compile.h
index 6c8a62d..b735617 100644
--- a/Include/compile.h
+++ b/Include/compile.h
@@ -44,7 +44,7 @@ typedef struct {
int co_nlocals; /* #local variables */
int co_stacksize; /* #entries needed for evaluation stack */
int co_flags; /* CO_..., see below */
- PyStringObject *co_code; /* instruction opcodes */
+ PyObject *co_code; /* instruction opcodes */
PyObject *co_consts; /* list (constants used) */
PyObject *co_names; /* list of strings (names used) */
PyObject *co_varnames; /* tuple of strings (local variable names) */
@@ -75,6 +75,11 @@ PyCodeObject *PyCode_New Py_PROTO((
PyObject *, PyObject *, int, PyObject *)); /* same as struct above */
int PyCode_Addr2Line Py_PROTO((PyCodeObject *, int));
+/* for internal use only */
+#define _PyCode_GETCODEPTR(co, pp) \
+ ((*(co)->co_code->ob_type->tp_as_buffer->bf_getreadbuffer) \
+ ((co)->co_code, 0, (void **)(pp)))
+
#ifdef __cplusplus
}
#endif