[Python-checkins] python/dist/src/Objects stringobject.c,2.205,2.206

doerwalter@users.sourceforge.net doerwalter@users.sourceforge.net
Mon, 31 Mar 2003 10:08:18 -0800


Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1:/tmp/cvs-serv22062/Objects

Modified Files:
	stringobject.c 
Log Message:
Fix PyString_Format() so that '%c' % u'a' returns u'a'
instead of raising a TypeError. (From SF patch #710127)

Add tests to verify this is fixed.

Add various tests for '%c' % int.


Index: stringobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v
retrieving revision 2.205
retrieving revision 2.206
diff -C2 -d -r2.205 -r2.206
*** stringobject.c	29 Jan 2003 17:58:45 -0000	2.205
--- stringobject.c	31 Mar 2003 18:07:42 -0000	2.206
***************
*** 3934,3937 ****
--- 3934,3944 ----
  				break;
  			case 'c':
+ #ifdef Py_USING_UNICODE
+ 				if (PyUnicode_Check(v)) {
+ 					fmt = fmt_start;
+ 					argidx = argidx_start;
+ 					goto unicode;
+ 				}
+ #endif
  				pbuf = formatbuf;
  				len = formatchar(pbuf, sizeof(formatbuf), v);