[Python-checkins] python/dist/src/Objects unicodeobject.c,2.159,2.160
gvanrossum@users.sourceforge.net
gvanrossum@users.sourceforge.net
2002年8月09日 08:36:50 -0700
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv24403/Objects
Modified Files:
unicodeobject.c
Log Message:
Unicode replace() method with empty pattern argument should fail, like
it does for 8-bit strings.
Index: unicodeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v
retrieving revision 2.159
retrieving revision 2.160
diff -C2 -d -r2.159 -r2.160
*** unicodeobject.c 6 Aug 2002 19:03:17 -0000 2.159
--- unicodeobject.c 9 Aug 2002 15:36:48 -0000 2.160
***************
*** 3456,3459 ****
--- 3456,3464 ----
PyUnicodeObject *u;
+ if (str1->length == 0) {
+ PyErr_SetString(PyExc_ValueError, "empty pattern string");
+ return NULL;
+ }
+
if (maxcount < 0)
maxcount = INT_MAX;