diff options
Diffstat (limited to 'pypy/objspace/std/unicodeobject.py')
-rw-r--r-- | pypy/objspace/std/unicodeobject.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/pypy/objspace/std/unicodeobject.py b/pypy/objspace/std/unicodeobject.py index 1dcd415912..4fa1a98437 100644 --- a/pypy/objspace/std/unicodeobject.py +++ b/pypy/objspace/std/unicodeobject.py @@ -880,8 +880,11 @@ class W_UnicodeObject(W_Root): count, isutf8=True) except OverflowError: raise oefmt(space.w_OverflowError, "replace string is too long") + if type(self) is W_UnicodeObject and replacements == 0: + return self newlength = self._length + replacements * (w_by._length - w_sub._length) + assert res is not None return W_UnicodeObject(res, newlength) def descr_mul(self, space, w_times): |