Mailing List Archive

CVS: python/dist/src/Objects unicodeobject.c,2.111,2.112
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv2176/python/Objects

Modified Files:
unicodeobject.c
Log Message:
More on bug 460020: disable many optimizations of unicode subclasses.


Index: unicodeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v
retrieving revision 2.111
retrieving revision 2.112
diff -C2 -d -r2.111 -r2.112
*** unicodeobject.c 2001/09/11 03:07:38 2.111
--- unicodeobject.c 2001/09/12 03:03:31 2.112
***************
*** 2704,2708 ****
Py_UNICODE_COPY(u->str, self->str, self->length);

! if (!fixfct(u)) {
/* fixfct should return TRUE if it modified the buffer. If
FALSE, return a reference to the original buffer instead
--- 2704,2708 ----
Py_UNICODE_COPY(u->str, self->str, self->length);

! if (!fixfct(u) && PyUnicode_CheckExact(self)) {
/* fixfct should return TRUE if it modified the buffer. If
FALSE, return a reference to the original buffer instead
***************
*** 2935,2939 ****
right = 0;

! if (left == 0 && right == 0) {
Py_INCREF(self);
return self;
--- 2935,2939 ----
right = 0;

! if (left == 0 && right == 0 && PyUnicode_CheckExact(self)) {
Py_INCREF(self);
return self;
***************
*** 3162,3166 ****
end--;

! if (start == 0 && end == self->length) {
/* couldn't strip anything off, return original string */
Py_INCREF(self);
--- 3162,3166 ----
end--;

! if (start == 0 && end == self->length && PyUnicode_CheckExact(self)) {
/* couldn't strip anything off, return original string */
Py_INCREF(self);
***************
*** 3189,3193 ****

/* replace characters */
! if (!findchar(self->str, self->length, str1->str[0])) {
/* nothing to replace, return original string */
Py_INCREF(self);
--- 3189,3194 ----

/* replace characters */
! if (!findchar(self->str, self->length, str1->str[0]) &&
! PyUnicode_CheckExact(self)) {
/* nothing to replace, return original string */
Py_INCREF(self);
***************
*** 3221,3225 ****
if (n > maxcount)
n = maxcount;
! if (n == 0) {
/* nothing to replace, return original string */
Py_INCREF(self);
--- 3222,3226 ----
if (n > maxcount)
n = maxcount;
! if (n == 0 && PyUnicode_CheckExact(self)) {
/* nothing to replace, return original string */
Py_INCREF(self);
***************
*** 3330,3334 ****
return NULL;

! if (self->length >= width) {
Py_INCREF(self);
return (PyObject*) self;
--- 3331,3335 ----
return NULL;

! if (self->length >= width && PyUnicode_CheckExact(self)) {
Py_INCREF(self);
return (PyObject*) self;
***************
*** 4086,4090 ****
return NULL;

! if (self->length >= width) {
Py_INCREF(self);
return (PyObject*) self;
--- 4087,4091 ----
return NULL;

! if (self->length >= width && PyUnicode_CheckExact(self)) {
Py_INCREF(self);
return (PyObject*) self;
***************
*** 4127,4131 ****
len = 0;

! if (len == 1) {
/* no repeat, return original string */
Py_INCREF(str);
--- 4128,4132 ----
len = 0;

! if (len == 1 && PyUnicode_CheckExact(str)) {
/* no repeat, return original string */
Py_INCREF(str);
***************
*** 4310,4314 ****
return NULL;

! if (self->length >= width) {
Py_INCREF(self);
return (PyObject*) self;
--- 4311,4315 ----
return NULL;

! if (self->length >= width && PyUnicode_CheckExact(self)) {
Py_INCREF(self);
return (PyObject*) self;
***************
*** 4339,4343 ****
if (end > self->length)
end = self->length;
! if (start == 0 && end == self->length) {
/* full slice, return original string */
Py_INCREF(self);
--- 4340,4344 ----
if (end > self->length)
end = self->length;
! if (start == 0 && end == self->length && PyUnicode_CheckExact(self)) {
/* full slice, return original string */
Py_INCREF(self);