From ecfeb7f095dfd9c1c8929bf3df858ee35e0d9e9e Mon Sep 17 00:00:00 2001 From: "Michael W. Hudson" Date: Thu, 12 Feb 2004 15:28:27 +0000 Subject: This is my patch #876198 plus a NEWS entry and a header frob. Remove the ability to use (from C) arbitrary objects supporting the read buffer interface as the co_code member of code objects. --- Include/compile.h | 5 ----- Misc/NEWS | 4 ++++ Python/ceval.c | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Include/compile.h b/Include/compile.h index 594d7df..82bf708 100644 --- a/Include/compile.h +++ b/Include/compile.h @@ -81,11 +81,6 @@ PyAPI_FUNC(PyCodeObject *) PyNode_CompileFlags(struct _node *, const char *, #define FUTURE_GENERATORS "generators" #define FUTURE_DIVISION "division" -/* 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 diff --git a/Misc/NEWS b/Misc/NEWS index 45068ad..d9778a3 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -12,6 +12,10 @@ What's New in Python 2.4 alpha 1? Core and builtins ----------------- +- Support for arbitrary objects supporting the read-only buffer + interface as the co_code field of code objects (something that was + only possible to create from C code) has been removed. + - Made omitted callback and None equivalent for weakref.ref() and weakref.proxy(); the None case wasn't handled correctly in all cases. diff --git a/Python/ceval.c b/Python/ceval.c index cf5e9ec..c6fb0bf 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -754,7 +754,7 @@ eval_frame(PyFrameObject *f) consts = co->co_consts; fastlocals = f->f_localsplus; freevars = f->f_localsplus + f->f_nlocals; - _PyCode_GETCODEPTR(co, &first_instr); + first_instr = PyString_AS_STRING(co->co_code); /* An explanation is in order for the next line. f->f_lasti now refers to the index of the last instruction -- cgit v0.12