[Python-checkins] CVS: python/dist/src/Python marshal.c,1.54,1.55

Tim Peters python-dev@python.org
Sun, 23 Jul 2000 12:28:37 -0700


Update of /cvsroot/python/python/dist/src/Python
In directory slayer.i.sourceforge.net:/tmp/cvs-serv8641/python/dist/src/Python

Modified Files:
	marshal.c 
Log Message:
Included assert.h in Python.h -- it's absurd that this basic tool of
good C practice hasn't been available to everything all along.
Added Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) macro to pyport.h; this
just casts VALUE from type WIDE to type NARROW, but assert-fails if
Py_DEBUG is defined and info is lost due to casting.
Replaced a line in Fredrik's fix to marshal.c to use the new macro.


Index: marshal.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/marshal.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -C2 -r1.54 -r1.55
*** marshal.c	2000/07/23 18:24:06	1.54
--- marshal.c	2000/07/23 19:28:35	1.55
***************
*** 70,74 ****
  		p->end =
  			PyString_AS_STRING((PyStringObject *)p->str) + newsize;
! 		*p->ptr++ = (char) c;
  	}
  }
--- 70,74 ----
  		p->end =
  			PyString_AS_STRING((PyStringObject *)p->str) + newsize;
! 		*p->ptr++ = Py_SAFE_DOWNCAST(c, int, char);
  	}
  }