[Python-checkins] CVS: python/dist/src/Python compile.c,2.229,2.230 marshal.c,1.68,1.69
Jeremy Hylton
jhylton@users.sourceforge.net
Fri, 09 Nov 2001 14:02:50 -0800
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv12872
Modified Files:
compile.c marshal.c
Log Message:
Use PyObject_CheckReadBuffer().
Index: compile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
retrieving revision 2.229
retrieving revision 2.230
diff -C2 -d -r2.229 -r2.230
*** compile.c 2001/11/09 19:50:08 2.229
--- compile.c 2001/11/09 22:02:46 2.230
***************
*** 269,273 ****
PyCodeObject *co;
int i;
- PyBufferProcs *pb;
/* Check argument types */
if (argcount < 0 || nlocals < 0 ||
--- 269,272 ----
***************
*** 280,293 ****
name == NULL || !PyString_Check(name) ||
filename == NULL || !PyString_Check(filename) ||
! lnotab == NULL || !PyString_Check(lnotab)) {
! PyErr_BadInternalCall();
! return NULL;
! }
! pb = code->ob_type->tp_as_buffer;
! if (pb == NULL ||
! pb->bf_getreadbuffer == NULL ||
! pb->bf_getsegcount == NULL ||
! (*pb->bf_getsegcount)(code, NULL) != 1)
! {
PyErr_BadInternalCall();
return NULL;
--- 279,284 ----
name == NULL || !PyString_Check(name) ||
filename == NULL || !PyString_Check(filename) ||
! lnotab == NULL || !PyString_Check(lnotab) ||
! !PyObject_CheckReadBuffer(code)) {
PyErr_BadInternalCall();
return NULL;
Index: marshal.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/marshal.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -C2 -d -r1.68 -r1.69
*** marshal.c 2001/10/19 01:46:21 1.68
--- marshal.c 2001/11/09 22:02:48 1.69
***************
*** 109,113 ****
{
int i, n;
- PyBufferProcs *pb;
p->depth++;
--- 109,112 ----
***************
*** 250,260 ****
w_object(co->co_lnotab, p);
}
! else if ((pb = v->ob_type->tp_as_buffer) != NULL &&
! pb->bf_getsegcount != NULL &&
! pb->bf_getreadbuffer != NULL &&
! (*pb->bf_getsegcount)(v, NULL) == 1)
! {
/* Write unknown buffer-style objects as a string */
char *s;
w_byte(TYPE_STRING, p);
n = (*pb->bf_getreadbuffer)(v, 0, (void **)&s);
--- 249,256 ----
w_object(co->co_lnotab, p);
}
! else if (PyObject_CheckReadBuffer(v)) {
/* Write unknown buffer-style objects as a string */
char *s;
+ PyBufferProcs *pb = v->ob_type->tp_as_buffer;
w_byte(TYPE_STRING, p);
n = (*pb->bf_getreadbuffer)(v, 0, (void **)&s);