summaryrefslogtreecommitdiffstats
path: root/contrib/python/PyHamcrest/py2/patches/01-speedup.patch
blob: 20ccb4b1e1e842ebd07ce5afcfa75fec4fb58ed3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
commit 4dc0f71a2788ed3530b053c0363738a8964f6a86
author: asatarin
date: 2017-10-13T16:14:43+03:00
revision: 3199619

    REVIEW:340199 Speed up StringDescription

--- contrib/python/PyHamcrest/py2/hamcrest/core/string_description.py	(94523234ff338f573e50b70f8cf7f6c8456bd3a1)
+++ contrib/python/PyHamcrest/py2/hamcrest/core/string_description.py	(4dc0f71a2788ed3530b053c0363738a8964f6a86)
@@ -24,21 +24,20 @@ def tostring(selfdescribing):
 class StringDescription(BaseDescription):
     """A :py:class:`~hamcrest.core.description.Description` that is stored as a
     string.
-
     """
 
     def __init__(self):
-        self.out = ''
+        self.__out_list = []
 
     def __str__(self):
         """Returns the description."""
-        return self.out
+        return ''.join(map(six.ensure_str, self.__out_list))
 
     def append(self, string):
         if six.PY3:
             self.out += str(string)
         else:
             if isinstance(string, unicode):
-                self.out += string
+                self.__out_list.append(string)
             else:
-                self.out += unicode(string, errors="ignore")
+                self.__out_list.append(unicode(string, errors="ignore"))