[pypy-commit] lang-js default: initialize length of W_StringObject

stepahn noreply at buildbot.pypy.org
Fri Dec 28 11:33:07 CET 2012


Author: Stephan <stephan at stzal.com>
Branch: 
Changeset: r169:392eb2efa651
Date: 2012-01-06 14:49 +0100
http://bitbucket.org/pypy/lang-js/changeset/392eb2efa651/

Log:	initialize length of W_StringObject

diff --git a/js/jsobj.py b/js/jsobj.py
--- a/js/jsobj.py
+++ b/js/jsobj.py
@@ -357,6 +357,10 @@
 
 class W_StringObject(W__PrimitiveObject):
     _class_ = 'String'
+    def __init__(self, primitive_value):
+        W__PrimitiveObject.__init__(self, primitive_value)
+        length = len(self._primitive_value_.ToString())
+        self._set_property('length', _w(length), DONT_ENUM | DONT_DELETE | READ_ONLY )
 
 class W__Object(W_BasicObject):
     def ToString(self):


More information about the pypy-commit mailing list