Ejemplo n.º 1
0
 def dereference(self, w_string):
     """
     Switches object strategy from reference one to general one
     """
     new_storage = ['\x00'] * self.len(w_string)
     self.write_into_list(w_string, new_storage, 0)
     strategy = get_string_strategy(MutableStringStrategy)
     w_string.storage = strategy.erase(new_storage)
     w_string.strategy = strategy
Ejemplo n.º 2
0
 def __init__(self, strval):
     from pie.objects.strategy.general import ConstantStringStrategy
     strategy = get_string_strategy(ConstantStringStrategy)
     self.storage = strategy.erase(strval)
     self.strategy = strategy
     self.copies = None
Ejemplo n.º 3
0
 def make_mutable(self, w_string):
     new_strategy = get_string_strategy(MutableStringStrategy)
     w_string.strategy = new_strategy
     w_string.storage = new_strategy.erase(
         [c for c in self.unerase(w_string.storage)]
     )