[Python-checkins] CVS: python/dist/src/Modules newmodule.c,2.35,2.36

Jeremy Hylton jhylton@users.sourceforge.net
Fri, 09 Nov 2001 14:02:29 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv12479

Modified Files:
	newmodule.c 
Log Message:
Use PyObject_CheckReadBuffer().


Index: newmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/newmodule.c,v
retrieving revision 2.35
retrieving revision 2.36
diff -C2 -d -r2.35 -r2.36
*** newmodule.c	2001/10/21 22:24:14	2.35
--- newmodule.c	2001/11/09 22:02:27	2.36
***************
*** 154,163 ****
  	}
  
! 	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_SetString(PyExc_TypeError,
  		  "bytecode object must be a single-segment read-only buffer");
--- 154,158 ----
  	}
  
! 	if (!PyObject_CheckReadBuffer(code)) {
  		PyErr_SetString(PyExc_TypeError,
  		  "bytecode object must be a single-segment read-only buffer");