Skip to content
Permalink
Browse files

Merge pull request #765 from kachick/fix-string-initialize

Fix String#initialize
  • Loading branch information
alex committed Jun 24, 2013
2 parents 95db3a3 + e18c215 commit 6bfad55abb2753c71d35b1297cdcb7bda5be9c77
Showing with 2 additions and 4 deletions.
  1. +0 −4 spec/tags/core/string/initialize_tags.txt
  2. +2 −0 topaz/objects/stringobject.py
@@ -1,8 +1,4 @@
fails:String#initialize with an argument returns self
fails:String#initialize with an argument taints self if other is tainted
fails:String#initialize with an argument untrusts self if other is untrusted
fails:String#initialize with an argument replaces the encoding of self with that of other
fails:String#initialize with an argument tries to convert other to string using to_str
fails:String#initialize with an argument raises a RuntimeError on a frozen instance that is modified
fails:String#initialize with no arguments does not raise an exception when frozen
fails:String#initialize with an argument raises a RuntimeError on a frozen instance when self-replacing
@@ -433,12 +433,14 @@ def singleton_method_allocate(self, space):
return W_StringObject(space, storage, strategy, self)

@classdef.method("initialize")
@check_frozen()
def method_initialize(self, space, w_s=None):
if w_s is not None:
w_s = space.convert_type(w_s, space.w_string, "to_str")
assert isinstance(w_s, W_StringObject)
self.strategy = w_s.strategy
self.str_storage = w_s.strategy.copy(w_s.str_storage)
return self

@classdef.method("initialize_copy")
def method_initialize_copy(self, space, w_other):

0 comments on commit 6bfad55

Please sign in to comment.
You can’t perform that action at this time.