Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ecfeb7f

Browse files
author
Michael W. Hudson
committed
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.
1 parent e6ed33a commit ecfeb7f

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

Include/compile.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,6 @@ PyAPI_FUNC(PyCodeObject *) PyNode_CompileFlags(struct _node *, const char *,
8181
#define FUTURE_GENERATORS "generators"
8282
#define FUTURE_DIVISION "division"
8383

84-
/* for internal use only */
85-
#define _PyCode_GETCODEPTR(co, pp) \
86-
((*(co)->co_code->ob_type->tp_as_buffer->bf_getreadbuffer) \
87-
((co)->co_code, 0, (void **)(pp)))
88-
8984
#ifdef __cplusplus
9085
}
9186
#endif

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ What's New in Python 2.4 alpha 1?
1212
Core and builtins
1313
-----------------
1414

15+
- Support for arbitrary objects supporting the read-only buffer
16+
interface as the co_code field of code objects (something that was
17+
only possible to create from C code) has been removed.
18+
1519
- Made omitted callback and None equivalent for weakref.ref() and
1620
weakref.proxy(); the None case wasn't handled correctly in all
1721
cases.

Python/ceval.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ eval_frame(PyFrameObject *f)
754754
consts = co->co_consts;
755755
fastlocals = f->f_localsplus;
756756
freevars = f->f_localsplus + f->f_nlocals;
757-
_PyCode_GETCODEPTR(co, &first_instr);
757+
first_instr = PyString_AS_STRING(co->co_code);
758758
/* An explanation is in order for the next line.
759759
760760
f->f_lasti now refers to the index of the last instruction

0 commit comments

Comments
 (0)