]> granicus.if.org Git - python/commitdiff
This is my patch #876198 plus a NEWS entry and a header frob.
authorMichael W. Hudson <mwh@python.net>
Thu, 12 Feb 2004 15:28:27 +0000 (15:28 +0000)
committerMichael W. Hudson <mwh@python.net>
Thu, 12 Feb 2004 15:28:27 +0000 (15:28 +0000)
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
Misc/NEWS
Python/ceval.c

index 594d7df7a3a273de2dd72a0c2414dbb8f9c425a4..82bf70862e66738253a67da3fc6572cc237798e4 100644 (file)
@@ -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
index 45068ada6bd1035f3641e2bdcbae0761801bbc13..d9778a3db6b60bb9f98415e0d0b312bfbac877cb 100644 (file)
--- 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.
index cf5e9ece42a2a16b31539047d27a927e06cdbd9a..c6fb0bf7e5498aad12e462769710d579a960295a 100644 (file)
@@ -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